3

I have packaged the eureka server provided by this repository https://github.com/spring-cloud-samples/eureka and tried to launch it on a cluster installation managed with Marathon/Mesos on which contraints on memory are set.

Nevertheless if I start the app in Marathon with 512MB it takes 100 seconds (each slaves have 32GB of RAM) to start instead of 12 seconds on my mac (16GB of RAM).

Even with configuring the Xms and Xms does not solve the issue. Using 256MB is even worse.

Jiujiu
  • 180
  • 11
  • Can you share your startup parameters? I saw similar behavior related to source of randoms being used by default. Can you try to go for: `-Djava.security.egd=file:/dev/./urandom`? This is not good in regards to security but in some cases it is actually acceptable. – daniel.eichten Apr 04 '16 at 07:57
  • Also, if you're using Docker you'll have a delay when the application is started the first time. 512MB seems a little low to me, what are the settings you're using on your MacBook? – Tobi Apr 04 '16 at 07:58
  • @daniel.eichten here is the command line I use to launch the eureka server in mesos `java \ -jar \ -Dspring.profiles.active=mesos \ -Xmx256m -Xms128m \ -XX:MaxMetaspaceSize=64m \ *.jar \ --discovery.server.port=$PORT0 \ --discovery.server.path=/discovery-server` with Memory 512 MiB and Disk Space 128 MiB. I have just tried the `security.edg` parameter and it does not change the behaviour. Increasing the number of CPU to 2 make the starting time better but it is not what I want. I would like to target 0.5 of CPU and 128 Mib if possible... – Jiujiu Apr 05 '16 at 06:41
  • @Tobi as you can see I'm launching directly the jar file – Jiujiu Apr 05 '16 at 06:42
  • hey @Jiujiu I have the same problem, or at least similar. If I start locally, eureka runs fine with memory constraint of 512mb, but on Mesos (DC/OS) it fails unless I set memory to 1gb or more. did you find any solution? – Luiz E. Nov 08 '16 at 21:13
  • @LuizE. unfortunately I have no improvement on this side. To be honest I have postponed how to fix it for the moment. Nevertheless I fear it cannot be addressed for the moment... – Jiujiu Nov 14 '16 at 13:49
  • @LuizE any improvements on your side? – Jiujiu Feb 07 '17 at 13:01
  • @Jiujiu I gave up on mesos – Luiz E. Feb 07 '17 at 13:07
  • @LuizE sorry to hear about that. Are you using another solution to replace mesos? – Jiujiu Feb 08 '17 at 13:35
  • I'm using docker cloud, so far so good – Luiz E. Feb 08 '17 at 13:54

1 Answers1

0

We have found this but no sure it can be applied to tomcat launched by spring boot

Inspired by

https://community.alfresco.com/docs/DOC-4914-jvm-tuning#w_generalcase

https://stackoverflow.com/a/33985214

Total memory in MB

TOTAL_MEM_KB=`free | awk '/^Mem:/{print $2}'`

Processor count

CPU_COUNT=`grep '^processor\s:' /proc/cpuinfo  | wc -l`

Take half memory for Xmx setting in GB

XMS=`expr ${TOTAL_MEM_KB} / 1000 / 1000 / 2`

MaxPerm hardcoded to 256M

MAX_PERM_MB="256"

HeapRegion is lower int round of Xmx/2048

G1_HEAP=`expr ${XMS} \* 1000 / 2048`

ParallelGC is half count of CPU (rounded to lower int)

PARA_GC=`expr ${CPU_COUNT} / 2`

ConcurrentGC is half ParallelGC

CONC_GC=`expr ${PARA_GC} / 2`

JAVA_MEM="-Xmx${XMS}g -XX:MaxPermSize=${MAX_PERM_MB}M -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:G1HeapRegionSize=${G1_HEAP} -XX:ParallelGCThreads=${PARA_GC} -XX:ConcGCThreads=${CONC_GC}"
Community
  • 1
  • 1
Jiujiu
  • 180
  • 11