# Jenkins and Java Xmx Xms

**URL:** <https://community.jenkins.io/t/jenkins-and-java-xmx-xms/6019>\
**Category:** Using Jenkins\
**Tags:** question\
**Created:** [February 28, 2023, 1:10pm UTC](https://community.jenkins.io/t/jenkins-and-java-xmx-xms/6019 "2023-02-28T13:10:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahaqaa](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/sahaqaa/32/3499_2.png) [@sahaqaa](https://community.jenkins.io/u/sahaqaa)\
**Post date:** [February 28, 2023, 1:10pm UTC](https://community.jenkins.io/t/jenkins-and-java-xmx-xms/6019/1 "2023-02-28T13:10:53Z")

</div>

Hello, this is my first post, i hope i’ve created it in the right place and with right tags.

Currently i have 3 Jenkins servers:

- 2.319.3 (Ubuntu 18.04)
- 2.319.2 (Ubuntu 18.04)
- 2.303.1 (Ubuntu 16.04)

Also i’m using “puppet-jenkins” module ([GitHub - voxpupuli/puppet-jenkins: Puppet module for Jenkins](https://github.com/voxpupuli/puppet-jenkins))

I installed 2 new Jenkins servers (Ubuntu 22.04, Jenkins 2.375.3 LTS)

Issue is: when i run “htop” i don’t see JAVA\_ARGS with Xms and Xmx arguments on new servers  
(while on currently used (older OS systems and older Jenkins major versions) everything OK.  
Is this expected?

* * *

Troubleshooting that was done:

I know that beginning with Jenkins 2.332.1 and Jenkins 2.335, the Linux package installers use systemd to manage services.

> **[Managing systemd services](https://www.jenkins.io/doc/book/system-administration/systemd-services/)**
>
> Jenkins – an open source automation server which enables developers around the world to reliably build, test, and deploy their software

Previously JAVA\_ARGS used to be configured in “/etc/default/jenkins” and after migration to SystemD now users need to put DropIn files into “/etc/systemd/system/jenkins.service.d/”

$ systemctl status jenkins.service  
● jenkins.service - Jenkins Continuous Integration Server  
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)  
Drop-In: /etc/systemd/system/jenkins.service.d  
└─puppet-overrides.conf  
Active: active (running) since Tue 2023-02-28 10:50:50 UTC; 16min ago  
Main PID: 6186 (java)  
Tasks: 55 (limit: 4618)  
Memory: 1.2G  
CPU: 1min 33.158s  
CGroup: /system.slice/jenkins.service  
└─6186 /usr/bin/java -Djava.awt.headless=true -Djenkins.install.runSetupWizard=false -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

content of “/etc/default/jenkins”:  
NAME=jenkins  
JAVA\_ARGS=“-Djava.awt.headless=true”  
PIDFILE=/var/run/$NAME/$NAME.pid  
JENKINS\_USER=$NAME  
JENKINS\_GROUP=$NAME  
JENKINS\_WAR=/usr/share/java/$NAME.war  
JENKINS\_HOME=/var/lib/$NAME  
RUN\_STANDALONE=true  
JENKINS\_LOG=/var/log/$NAME/$NAME.log  
JENKINS\_ENABLE\_ACCESS\_LOG=“no”  
MAXOPENFILES=8192  
HTTP\_PORT=8080  
PREFIX=/$NAME  
JENKINS\_ARGS=“–webroot=/var/cache/$NAME/war --httpPort=$HTTP\_PORT”

$ cat /etc/systemd/system/jenkins.service.d/puppet-overrides.conf  
[Service]  
Environment=“JAVA\_OPTS=-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false”  
Environment=“HTTP\_PORT=8080”  
Environment=“AJP\_PORT=-1”  
Environment=“HTTP\_HOST=127.0.0.1”  
Environment=“JENKINS\_ARGS=–webroot=/var/cache/$NAME/war --httpListenAddress=$HTTP\_HOST --httpPort=$HTTP\_PORT --sessionTimeout=10080 --sessionEviction=302400”  
Environment=“JAVA\_ARGS=-Djava.awt.headless=true -Xms1620m -Xmx2835m -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1”  
Environment=“MAXOPENFILES=8192”

$ systemctl show jenkins | grep Drop  
DropInPaths=/etc/systemd/system/jenkins.service.d/puppet-overrides.conf

$ systemctl show jenkins | grep JAVA  
Environment=JENKINS\_HOME=/var/lib/jenkins JENKINS\_WEBROOT=/var/cache/jenkins/war “JAVA\_OPTS=-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false” JENKINS\_PORT=8080 HTTP\_PORT=8080 AJP\_PORT=-1 HTTP\_HOST=127.0.0.1 “JENKINS\_ARGS=–webroot=/var/cache/$NAME/war --httpListenAddress=$HTTP\_HOST --httpPort=$HTTP\_PORT --sessionTimeout=10080 --sessionEviction=302400” “JAVA\_ARGS=-Djava.awt.headless=true -Xms1620m -Xmx2835m -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1” MAXOPENFILES=8192

Technically i can see in next output that Jenkins Java JVM actually has correct settings under the hood:  
$ cat /proc/6186/task/6186/environ  
JENKINS\_HOME=/var/lib/jenkinsUSER=jenkinsAJP\_PORT=-1JENKINS\_ARGS=–webroot=/var/cache/$NAME/war --httpListenAddress=$HTTP\_HOST --httpPort=$HTTP\_PORT --sessionTimeout=10080 --sessionEviction=302400HOME=/var/lib/jenkinsNOTIFY\_SOCKET=/run/systemd/notifySYSTEMD\_EXEC\_PID=6186HTTP\_HOST=127.0.0.1LOGNAME=jenkinsJOURNAL\_STREAM=8:50608HTTP\_PORT=8080PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/binINVOCATION\_ID=c731108157ef4ae09285f415a4afab9fLANG=en\_US.UTF-8SHELL=/bin/shMAXOPENFILES=8192PWD=/var/lib/jenkinsJAVA\_ARGS=-Djava.awt.headless=true -Xms1620m -Xmx2835m -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1

But why it is not displayed (as usual) in “htop” output?

While doing troubleshooting on Ubuntu 22.04, Jenkins 2.375.3 LTS i entered “JAVA\_ARGS” into “/etc/default/jenkins”, restarted service → and it was actually applied. I’ve seen in “htop” this argument again, with proper values and memory usage droped correctly (as expected).

So seems that in “htop” JAVA\_ARGS are not displayed. This is kinda confusing to understand (for me as regular user) if Xmx and Xms settings were applied or not and i had to dig to understand if it is Ok or not.

---

<div class="post-metadata">

**Author:** ![sahaqaa](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/sahaqaa/32/3499_2.png) [@sahaqaa](https://community.jenkins.io/u/sahaqaa)\
**Post date:** [February 28, 2023, 1:13pm UTC](https://community.jenkins.io/t/jenkins-and-java-xmx-xms/6019/2 "2023-02-28T13:13:33Z")

</div>

![normal picture](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/6/6dfb0c00090073bcc550d17406d9349012d8938f.png)

---

<div class="post-metadata">

**Author:** ![sahaqaa](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/sahaqaa/32/3499_2.png) [@sahaqaa](https://community.jenkins.io/u/sahaqaa)\
**Post date:** [February 28, 2023, 1:14pm UTC](https://community.jenkins.io/t/jenkins-and-java-xmx-xms/6019/3 "2023-02-28T13:14:10Z")

</div>

![not normal picture](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/1/1fc1c1d8f1405fbdcd47a3970ede507fb0c9119b.png)
