Spring boot memory boot

We have a Spring Boot based application. We deploy it using an executable jar, which is about 20 megabytes. When we launch this application, it immediately uses the memory of the β€œVirutual” 18Gigs. I understand that most of them are stored in secondary storage, such as a hard drive, but our system administrators ask why we need so much virtual memory.

The jar file is small. When I start, I use BoneCPDataSource, but I reduced the number of connections to 5. As soon as the application is running, it uses 18 g of virtual memory.

Can someone tell me why? Do I have to play with java memory settings on the command line to reduce this number? The team we use:

java -jar filename.jar

According to the request, here is additional information:

1) Here is the line from the 'top'

command : 24511 xyz 20 0 17.6g 531m 9.8m S 0.0 0.8 0: 16.57 java

2) No Neo4J. Here is my pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0

<groupId>com.xyz.myapp</groupId>
<artifactId>myapp-rest-service</artifactId>
<version>0.1.0</version>

<properties>
    <start-class>com.xyz.myapp.rest.Application</start-class>
</properties>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.1.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>com.jolbox</groupId>
        <artifactId>bonecp</artifactId>
        <version>0.8.0.RELEASE</version>
        <exclusions>
            <exclusion>
                <groupId>com.jolbox</groupId>
                <artifactId>com.jolbox.logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>oracle</groupId>
        <artifactId>jdbc</artifactId>
        <version>6.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.18.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin> 
            <artifactId>maven-compiler-plugin</artifactId> 
            <version>2.3.2</version> 
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
</pluginRepositories>

3) I create this application using the following command:

mvn clean package

and this is what it creates in the directory. / target:

-rwxr-xr-x 1 myuserid Domain Users 20259555 Jun 9 15:36 myapp-rest-service-0.1.0.jar

4) lsof for my application:

http://pastebin.com/V00BrD67

5) Conclusion from the mvn: tree dependency

http://pastebin.com/cFnR0NMX

+4
source share
2 answers

-Xmx . Spring :

java -Xmx4096m -jar myapp-rest-service-0.1.0.jar

application.properties ( ), , .

+6

JVM ( ). JVM /.

: " Java- "

this SO ( Jabir): JVM Sun Java SE 6?

+4

Source: https://habr.com/ru/post/1543913/


All Articles