Search code examples
spring-cloud-config

Spring Cloud Config Server - Expected Memory Footprint Seems Large


Spring Cloud Config Server - 1.4.2.RELEASE

Java 8

I have a vanilla Spring Cloud Config Server (POM below). Main features used are:

  • downloading config files from Git
  • encryption/decryption through an SSH file

When I start it up with no memory constraints it cranks up to 7460.88 Mb.

When I add constraints like below, it is at 3653.82 Mb.

-Xms256m -Xmx256m -Xmn96m -XX:+UseNUMA -XX:+UseG1GC -XX:+AlwaysPreTouch -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled

As you can tell by my memory constraints I was expecting it to hang out around 256 Mb.

  • Was this an unrealistic expectation?
  • Is there a way to get it down further?

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>any.group</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    
    <name>spring-cloud-config-server</name>
    <description>Spring-Cloud-Config-Server that loads configuration from GIT for Spring Boot Applications.</description>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.10.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    
    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>1.4.2.RELEASE</spring-cloud.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
            <version>${spring-cloud.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    


Solution

  • Nevermind, believe I was calculating the memory wrong.

    I was using this command originally: https://stackoverflow.com/a/44711589/4681044

    But instead now I used the "top" command and got the percentage and used that against the total available and got 492Mb.