'Spring boot eureka server taking up too much CPU and RAM
I am using following pom.xml for my Eureka Server and running in a standalone mode with around 300+ services are being registered on it.
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.etp</groupId>
<artifactId>service-registry</artifactId>
<version>0.0.1</version>
<name>Eureka server</name>
<description>Spring Boot Service registry</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
<log4j2.version>2.17.1</log4j2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
application.properties for the service :
spring.application.name=service-registry
server.port=8080
eureka.client.register-with-eureka = false
eureka.client.fetch-registry =false
eureka.client.serviceUrl.defaultZone:http://IP:8080/eureka
Dockerfile :
FROM openjdk:8
WORKDIR /
ADD /target/*.jar service-registry.jar
ADD configuration/application.properties configuration/application.properties
ADD configuration/logback.xml configuration/logback.xml
EXPOSE 8080
ENTRYPOINT ["java","-jar","service-registry.jar"]
When I start/restart eureka service then it takes up around 35-40% of the entire CPU available and memory consumption keeps on increasing continuously. After keeping the service ON for say ~2 days it takes up all memory which has been allocated right now.( ~1Gb) Is there any way to reduce the memory or cpu consumption for eureka server ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
