Java TM platform SE Binary consuming 99% CPU - bringing Jenkins to halt

Since a couple of weeks, I started to notice that my jenkins get hanged and Java SE binary consumption always going up to 95-98%. I updated the OPNJdk to 17 as I thougt old java might be the cause, it became worst.
This is becoming very annoying as I need to restart jenkins every 10-15 minutes as it gets blocked and I need to restart it to be able to work with. Can you please let me know what config needs to be changed or anything to update? Thanks in advance

Jenkins setup:

Jenkins: 2.436
OS: Windows Server 2019 - 10.0
Java: 11.0.18 - Oracle Corporation (Java HotSpot(TM) 64-Bit Server VM)
---
ace-editor:1.1
active-directory:2.34
adoptopenjdk:1.5
all-changes:1.5
analysis-core:1.95
ansible:240.vc26740a_625c0
ant:487.vd79d090d4ea_e
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
artifactdeployer:1.3
audit-trail:333.vb_e1b_b_0f1238c
audit2db:0.5
authentication-tokens:1.53.v1c90fd9191a_b_
aws-codepipeline:0.46
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk:1.12.447-382.vda_68e2007233
aws-java-sdk-cloudformation:1.12.447-382.vda_68e2007233
aws-java-sdk-codebuild:1.12.447-382.vda_68e2007233
aws-java-sdk-ec2:1.12.447-382.vda_68e2007233
aws-java-sdk-ecr:1.12.447-382.vda_68e2007233
aws-java-sdk-ecs:1.12.447-382.vda_68e2007233
aws-java-sdk-efs:1.12.447-382.vda_68e2007233
aws-java-sdk-elasticbeanstalk:1.12.447-382.vda_68e2007233
aws-java-sdk-iam:1.12.447-382.vda_68e2007233
aws-java-sdk-kinesis:1.12.447-382.vda_68e2007233
aws-java-sdk-logs:1.12.447-382.vda_68e2007233
aws-java-sdk-minimal:1.12.447-382.vda_68e2007233
aws-java-sdk-sns:1.12.447-382.vda_68e2007233
aws-java-sdk-sqs:1.12.447-382.vda_68e2007233
aws-java-sdk-ssm:1.12.447-382.vda_68e2007233
aws-lambda:0.5.10
awseb-deployment-plugin:0.3.21
azure-acs:1.0.4
azure-ad:433.v1982e2b_b_4a_fe
azure-app-service:1.0.2
azure-cli:0.9
azure-commons:1.1.3
azure-container-agents:253.vd2f5cd5c5040
azure-credentials:293.vb_d506148f506
azure-function:0.3.3
azure-sdk:132.v62b_48eb_6f32f
azure-slave-plugin:0.3.4
azure-vm-agents:883.v63c930b_025dc
azure-vmss:0.2.4
backup:1.6.1
blueocean:1.27.5.1
blueocean-bitbucket-pipeline:1.27.5.1
blueocean-commons:1.27.5.1
blueocean-config:1.27.5.1
blueocean-core-js:1.27.5.1
blueocean-dashboard:1.27.5.1
blueocean-display-url:2.4.1
blueocean-events:1.27.5.1
blueocean-git-pipeline:1.27.5.1
blueocean-github-pipeline:1.27.5.1
blueocean-i18n:1.27.5.1
blueocean-jwt:1.27.5.1
blueocean-personalization:1.27.5.1
blueocean-pipeline-api-impl:1.27.5.1
blueocean-pipeline-editor:1.27.5.1
blueocean-pipeline-scm-api:1.27.5.1
blueocean-rest:1.27.5.1
blueocean-rest-impl:1.27.5.1
blueocean-web:1.27.5.1
bootstrap4-api:4.6.0-5
bootstrap5-api:5.3.2-2
bouncycastle-api:2.27
branch-api:2.1128.v717130d4f816
build-failure-analyzer:2.4.2
build-monitor-plugin:1.14-681.vd6817317a_2b_7
build-pipeline-plugin:1.5.8
build-with-parameters:76.v9382db_f78962
caffeine-api:3.1.8-133.v17b_1ff2e0599
ccm:3.2
change-assembly-version-plugin:1.10
checks-api:2.0.0
cloud-stats:320.v96b_65297a_4b_b_
cloudbees-bitbucket-branch-source:800.va_b_b_9a_a_5035c1
cloudbees-credentials:3.3
cloudbees-folder:6.858.v898218f3609d
cobertura:1.17
code-coverage-api:4.3.0
codecover:1.1
codedeploy:1.23
command-launcher:90.v669d7ccb_7c31
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-94.v3e1f4a_926e49
conditional-buildstep:1.4.2
config-file-provider:959.vcff671a_4518b_
copyartifact:698.v393f578eb_ddc
covcomplplot:1.1.1
credentials:1309.v8835d63eb_d8a_
credentials-binding:642.v737c34dea_6c2
cvs:2.19.1
dashboard-view:2.472.v9ff2a_e6a_c529
data-tables-api:1.13.3-3
delivery-pipeline-plugin:1.4.2
dependency-check-jenkins-plugin:5.4.3
dependency-track:4.3.1
deployment-notification:78.v94930204e4f7
disk-usage:0.28
display-url-api:2.200.vb_9327d658781
docker-build-publish:1.4.0
docker-build-step:2.9
docker-commons:419.v8e3cd84ef49c
docker-custom-build-environment:1.7.3
docker-java-api:3.2.13-68.va_875df25a_b_45
docker-plugin:1.3.0
docker-slaves:1.0.7
docker-workflow:563.vd5d2e5c4007f
dos-trigger:1.23
durable-task:523.va_a_22cf15d5e0
ec2:2.0.7
ec2-deployment-dashboard:1.0.10
echarts-api:5.4.0-7
email-ext:2.102
emailext-template:1.5
emma:1.31
envinject:2.901.v0038b_6471582
envinject-api:1.199.v3ce31253ed13
extended-read-permission:3.2
external-monitor-job:203.v683c09d993b_9
favorite:2.4.1
flyway-runner:1.9
font-awesome-api:6.4.2-1
forensics-api:2.1.0
ftppublisher:1.2
fxcop-runner:1.1
git:5.2.1
git-client:4.5.0
git-server:99.va_0826a_b_cdfa_d
github:1.37.3.1
github-api:1.316-451.v15738eef3414
github-branch-source:1703.vd5a_2b_29c6cdc
greenballs:1.15.1
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
html-audio-notifier:0.4
htmlpublisher:1.31
http-post:1.2
http_request:1.16
icon-shim:3.0.0
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.3-363.v82c51b_de9f60
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:233.vdc1a_ec702cff
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.8-1
jdk-tool:66.vd8fa_64ee91b_d
jenkins-design-language:1.27.5.1
jjwt-api:0.11.5-77.v646c772fddb_0
jqs-monitoring:37.vf50a_82a_0b_f32
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.7.1-1
jsch:0.2.8-65.v052c39de79b_2
junit:1240.vf9529b_881428
kubernetes-cd:2.3.1
ldap:711.vb_d1a_491714dc
lockable-resources:1141.v7c5f8f31d2ee
log-parser:2.3.0
logstash:2.5.0205.vd05825ed46bd
m2release:0.16.3
mail-watcher-plugin:1.18
mailcommander:1.0.0
mailer:463.vedf8358e006b_
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.2.1
matrix-project:818.v7eb_e657db_924
maven-plugin:3.23
metrics:4.2.18-442.v02e107157925
mina-sshd-api-common:2.11.0-86.v836f585d47fa_
mina-sshd-api-core:2.11.0-86.v836f585d47fa_
momentjs:1.1.1
mongodb-document-upload:1.0
monitoring:1.94.0
msbuild:1.30
mstest:1.0.3
mstestrunner:1.5.0
nant:248.vcc8a_3eec8db_a
ncover:0.3
node-iterator-api:49.v58a_8b_35f8363
nodejs:1.6.1
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
pam-auth:1.10
parameterized-trigger:2.46
pipeline-build-step:516.v8ee60a_81c5b_9
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:689.veec561a_dee13
pipeline-input-step:477.v339683a_8d55e
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2150.v4cfd8916915c
pipeline-model-definition:2.2150.v4cfd8916915c
pipeline-model-extensions:2.2150.v4cfd8916915c
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.32
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2150.v4cfd8916915c
pipeline-stage-view:2.32
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.6.0
popper-api:1.16.1-3
popper2-api:2.11.6-2
powershell:2.0
prism-api:1.29.0-4
promoted-builds:892.vd6219fc0a_efb
promoted-builds-simple:1.9
publish-over:0.22
publish-over-dropbox:1.3.2
publish-over-ssh:1.24
pubsub-light:1.17
puppet:1.1
rabbitmq-consumer:2.8
regexemail:0.3
resource-disposer:0.23
run-condition:1.5
scm-api:676.v886669a_199a_a_
script-security:1281.v22fb_899df1a_e
selected-tests-executor:1.3.3
service-fabric:1.6
sidebar-link:2.4.1
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sonar:2.16.1
sse-gateway:1.26
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.275.v9e17c10f2571
stackhammer:1.0.6
structs:325.vcb_307d2a_2782
subversion:2.17.3
svnpublisher:0.1
template-workflows:41.v32d86a_313b_4a
text-file-operations:1.3.2
tfs:5.142.0
thinBackup:1.17
token-macro:384.vf35b_f26814ec
translation:1.16
trilead-api:2.84.v72119de229b_7
ui-test-capture:1.0.43
vagrant:1.0.2
variables-replace-plugin:1.0.0
variant:59.vf075fe829ccb
versioncolumn:145.va_e3ca_f8a_a_d23
violation-columns:1.6
violations:0.7.11
virtualbox:0.7
vs-code-metrics:1.7
vstestrunner:1.0.8
vsts-cd:1.3
windocks-start-container:1.4
windows-azure-storage:386.v673495b0a5de
windows-slaves:1.8.1
workflow-aggregator:596.v8c21c963d92d
workflow-api:1283.v99c10937efcb_
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3806.va_3a_6988277b_2
workflow-cps-global-lib:609.vd95673f149b_b
workflow-durable-task-step:1289.v4d3e7b_01546b_
workflow-job:1326.ve643e00e9220
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45

Welcome back @eliassal. :wave:

Would you have any logs to share?

Ancillary to the CPU load, using an Oracle JDK to run Jenkins is likely a violation of Oracle’s license agreement (or an expensive proposition), as noted in this thread. You should consider an OpenJDK (hotspot) alternative

1 Like

Hi and thanks, yes, after posting this thread I noticed that jenkins, even after the openjdk 17 install did not change and kept using version 11. I opened the file jenkins.xml and noticed that I had
<executable>C:\Program Files\....\jdk-11\bin\java</executable>.
I thought that modifying the value for JAVA_HOME to 17 will do the job which was not the case. I replaced it with
<executable>C:\Program Files\Eclipse Adoptium\jdk-17.0.9.9-hotspot\bin\java</executable>
, since that time CPU consumption is normal.
So now the question why jenkins consider config in jenkins.xml whereas from installation instructions I understand that it looks for java_home.

With the new JDK, C:\Program Files\Eclipse Adoptium\jdk-17.0.9.9-hotspot\bin\java, I am having the same behaviore, binaries shooting CPU 98%
@poddingue which log files you need?

when Java Binaris is about constant 97%%

Inside browser, jenkins fails to load the page

image

And now, since 10 minutes whatever link I click I get a blank page. I needed to restart jenkins service to be able to acces it

And here is the output of the script after JDK change

Jenkins: 2.436
OS: Windows Server 2019 - 10.0
Java: 17.0.9 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
active-directory:2.34
adoptopenjdk:1.5
all-changes:1.5
ansible:240.vc26740a_625c0
ant:487.vd79d090d4ea_e
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.2.3-1.0
artifactdeployer:1.3
audit-trail:333.vb_e1b_b_0f1238c
audit2db:0.5
authentication-tokens:1.53.v1c90fd9191a_b_
aws-codepipeline:0.46
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk:1.12.447-382.vda_68e2007233
aws-java-sdk-cloudformation:1.12.447-382.vda_68e2007233
aws-java-sdk-codebuild:1.12.447-382.vda_68e2007233
aws-java-sdk-ec2:1.12.447-382.vda_68e2007233
aws-java-sdk-ecr:1.12.447-382.vda_68e2007233
aws-java-sdk-ecs:1.12.447-382.vda_68e2007233
aws-java-sdk-efs:1.12.447-382.vda_68e2007233
aws-java-sdk-elasticbeanstalk:1.12.447-382.vda_68e2007233
aws-java-sdk-iam:1.12.447-382.vda_68e2007233
aws-java-sdk-kinesis:1.12.447-382.vda_68e2007233
aws-java-sdk-logs:1.12.447-382.vda_68e2007233
aws-java-sdk-minimal:1.12.447-382.vda_68e2007233
aws-java-sdk-sns:1.12.447-382.vda_68e2007233
aws-java-sdk-sqs:1.12.447-382.vda_68e2007233
aws-java-sdk-ssm:1.12.447-382.vda_68e2007233
aws-lambda:0.5.10
awseb-deployment-plugin:0.3.21
azure-acs:1.0.4
azure-ad:442.v355cca_6b_c169
azure-app-service:1.0.2
azure-cli:0.9
azure-commons:1.1.3
azure-container-agents:253.vd2f5cd5c5040
azure-credentials:312.v0f3973cd1e59
azure-function:0.3.3
azure-sdk:157.v855da_0b_eb_dc2
azure-slave-plugin:0.3.4
azure-vm-agents:898.v7309274ccd9c
azure-vmss:0.2.4
backup:1.6.1
blueocean:1.27.9
blueocean-bitbucket-pipeline:1.27.9
blueocean-commons:1.27.9
blueocean-config:1.27.9
blueocean-core-js:1.27.9
blueocean-dashboard:1.27.9
blueocean-display-url:2.4.2
blueocean-events:1.27.9
blueocean-git-pipeline:1.27.9
blueocean-github-pipeline:1.27.9
blueocean-i18n:1.27.9
blueocean-jwt:1.27.9
blueocean-personalization:1.27.9
blueocean-pipeline-api-impl:1.27.9
blueocean-pipeline-editor:1.27.9
blueocean-pipeline-scm-api:1.27.9
blueocean-rest:1.27.9
blueocean-rest-impl:1.27.9
blueocean-web:1.27.9
bootstrap5-api:5.3.2-3
bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9
branch-api:2.1135.v8de8e7899051
build-failure-analyzer:2.4.2
build-monitor-plugin:1.14-745.ve2023a_305f40
build-pipeline-plugin:2.0.1
build-with-parameters:76.v9382db_f78962
caffeine-api:3.1.8-133.v17b_1ff2e0599
change-assembly-version-plugin:1.10
checks-api:2.0.2
cloud-stats:320.v96b_65297a_4b_b_
cloudbees-bitbucket-branch-source:856.v04c46c86f911
cloudbees-credentials:3.3
cloudbees-folder:6.858.v898218f3609d
cobertura:1.17
code-coverage-api:4.3.0
codecover:1.1
codedeploy:1.23
command-launcher:107.v773860566e2e
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-95.v22a_d30ee5d36
conditional-buildstep:1.4.3
config-file-provider:959.vcff671a_4518b_
copyartifact:722.v0662a_9b_e22a_c
covcomplplot:1.1.1
credentials:1311.vcf0a_900b_37c2
credentials-binding:642.v737c34dea_6c2
cvs:2.19.1
dashboard-view:2.495.v07e81500c3f2
data-tables-api:1.13.8-2
delivery-pipeline-plugin:1.4.2
dependency-check-jenkins-plugin:5.4.3
dependency-track:4.3.1
deployment-notification:78.v94930204e4f7
disk-usage:1.2
display-url-api:2.200.vb_9327d658781
docker-build-publish:1.4.0
docker-build-step:2.10
docker-commons:439.va_3cb_0a_6a_fb_29
docker-custom-build-environment:1.7.3
docker-java-api:3.3.4-86.v39b_a_5ede342c
docker-plugin:1.5
docker-slaves:1.0.7
docker-workflow:572.v950f58993843
dos-trigger:1.23
durable-task:523.va_a_22cf15d5e0
ec2:2.0.7
ec2-deployment-dashboard:1.0.10
echarts-api:5.4.3-2
email-ext:2.102
emailext-template:1.5
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
extended-read-permission:53.v6499940139e5
external-monitor-job:215.v2e88e894db_f8
favorite:2.208.v91d65b_7792a_c
flyway-api:9.22.3-19.v517419376361
flyway-runner:80.v79ee3c4605a_c
font-awesome-api:6.5.1-1
forensics-api:2.3.0
ftppublisher:1.2
fxcop-runner:1.1
git:5.2.1
git-client:4.6.0
git-server:99.va_0826a_b_cdfa_d
github:1.37.3.1
github-api:1.318-461.v7a_c09c9fa_d63
github-branch-source:1758.v048414714f5d
gson-api:2.10.1-3.vb_25b_599b_e4f8
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
html-audio-notifier:0.4
htmlpublisher:1.32
http-post:1.2
http_request:1.18
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.3-372.v309620682326
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jdk-tool:73.vddf737284550
jenkins-design-language:1.27.9
jjwt-api:0.11.5-77.v646c772fddb_0
joda-time-api:2.12.5-5.v5495a_235fedf
jqs-monitoring:37.vf50a_82a_0b_f32
jquery:1.12.4-1
jquery3-api:3.7.1-1
jsch:0.2.8-65.v052c39de79b_2
junit:1252.vfc2e5efa_294f
kubernetes-cd:2.3.1
ldap:711.vb_d1a_491714dc
lockable-resources:1218.va_3dd45e2b_fa_7
log-parser:2.3.1
logstash:2.5.0218.v0a_ff8fefc12b_
m2release:0.16.4
mail-watcher-plugin:1.18
mailcommander:1.0.0
mailer:463.vedf8358e006b_
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.2.1
matrix-project:818.v7eb_e657db_924
maven-plugin:3.23
metrics:4.2.18-442.v02e107157925
mina-sshd-api-common:2.11.0-86.v836f585d47fa_
mina-sshd-api-core:2.11.0-86.v836f585d47fa_
mongodb-document-upload:1.0
monitoring:1.95.0
msbuild:1.30
mstest:1.0.5
mstestrunner:1.5.0
nant:248.vcc8a_3eec8db_a
ncover:0.3
node-iterator-api:55.v3b_77d4032326
nodejs:1.6.1
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
pam-auth:1.10
parameterized-trigger:787.v665fcf2a_830b_
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:689.veec561a_dee13
pipeline-input-step:477.v339683a_8d55e
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2151.ve32c9d209a_3f
pipeline-model-definition:2.2151.ve32c9d209a_3f
pipeline-model-extensions:2.2151.ve32c9d209a_3f
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.34
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2151.ve32c9d209a_3f
pipeline-stage-view:2.34
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.6.0
powershell:2.1
prism-api:1.29.0-4
promoted-builds:940.va_9b_59a_717a_b_1
promoted-builds-simple:1.9
publish-over:0.22
publish-over-dropbox:1.3.2
publish-over-ssh:1.25
pubsub-light:1.18
puppet:1.1
rabbitmq-consumer:2.8
regexemail:0.3
resource-disposer:0.23
run-condition:1.7
scm-api:676.v886669a_199a_a_
script-security:1281.v22fb_899df1a_e
selected-tests-executor:1.3.3
service-fabric:1.6
sidebar-link:2.4.1
snakeyaml-api:2.2-111.vc6598e30cc65
sonar:2.16.1
sse-gateway:1.26
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.945.v90744dcb_47cd
sshd:3.275.v9e17c10f2571
stackhammer:1.0.6
structs:325.vcb_307d2a_2782
subversion:2.17.3
svnpublisher:0.1
template-workflows:41.v32d86a_313b_4a
text-file-operations:1.3.2
thinBackup:1.17
token-macro:384.vf35b_f26814ec
trilead-api:2.84.v72119de229b_7
ui-test-capture:1.0.43
vagrant:1.0.2
variables-replace-plugin:1.0.0
variant:59.vf075fe829ccb
versioncolumn:145.va_e3ca_f8a_a_d23
virtualbox:0.7
vstestrunner:1.0.8
windocks-start-container:1.4
windows-azure-storage:415.v81b755afe213
workflow-aggregator:596.v8c21c963d92d
workflow-api:1283.v99c10937efcb_
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3826.v3b_5707fe44da_
workflow-cps-global-lib:609.vd95673f149b_b
workflow-durable-task-step:1289.v4d3e7b_01546b_
workflow-job:1385.vb_58b_86ea_fff1
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45

How much memory do you give to your Jenkins?

It is VM with 4G of RAM and 2 CPUs

are you using -Xmx and -Xms java startup options?
You should check the jenkins logs, as you browser failed to load the page, there must be something in the logs.
When you see high CPU usage, take a threaddump of your java process and analyze it.

@mawinter69 where can I find those -Xmx and -Xms startup options?

if you don’t know this then probably you’re not using them. They should probably be part of the xml you use to start jenkins.
If your system is short on memory the jvm might spend a lot of time with garbage collection

I double-checked jenkinsxml, I have this
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

so those arguments might be the issue?

yes you give your vm 4 GiB memory but your jvm only gets 256m. Set it to -Xmx3g (3GiB, leave a bit to the other processes inside the container).

Yes, you are correct, since I updated -Xmx the CPU consumption disappeared, thanks for your help