jenkins-infra / helpdesk

Open your Infrastructure related issues here for the Jenkins project
https://github.com/jenkins-infra/helpdesk/issues/new/choose
17 stars 10 forks source link

`ci.jenkins.io` disk almost full #3492

Closed smerle33 closed 1 year ago

smerle33 commented 1 year ago
          During the research for information as to which controller was impacted, we discovered that `ci.jenkins.io` had the same kind of disk usage : 
/dev/sdb1    492G 443G  24G 95% /var/lib/jenkins

this need to be fixed.

Originally posted by @smerle33 in https://github.com/jenkins-infra/helpdesk/issues/3491#issuecomment-1498745076

smerle33 commented 1 year ago

steps foreseen :

smerle33 commented 1 year ago

to increase over 512Gib we will have to change to 1024Gib disk and then change of Disk tiers

dduportal commented 1 year ago

We discovered that $JENKINS_HOME/config-history weights 27Gb!

It's the directory where https://plugins.jenkins.io/jobConfigHistory/ stores the "config changes".

The current setup is the default one: we could set up some of the best practises from https://docs.cloudbees.com/docs/cloudbees-ci-kb/latest/best-practices/jobconfighistory-best-practices to decrease the disk usage (move it on another drive?) and improve I/O performances for ci.j (at least removing the nodes and tools from history)

dduportal commented 1 year ago

Ping @MarkEWaite , could you share what you did in https://github.com/jenkins-infra/helpdesk/issues/2736 last time it happenned?

MarkEWaite commented 1 year ago

I think that I deleted history. I think that we should remove that plugin from the ci.jenkins.io instance and accept that job configuration history is not worth the disc space penalty

dduportal commented 1 year ago
dduportal commented 1 year ago
$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  436G   31G  94% /var/lib/jenkins
dduportal commented 1 year ago

=> cleaning up led to a size of 5.6 Gb

dduportal commented 1 year ago
properties([disableConcurrentBuilds(abortPrevious: true), buildDiscarder(logRotator(numToKeepStr: '10'))])
echo 'https://github.com/jenkins-infra/helpdesk/issues/3492 investigation, retain 10 most recent builds'
df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  391G   76G  84% /var/lib/jenkins
dduportal commented 1 year ago

As seen with @smerle33 , the next "culprit" will be the top-level item "Websites" which weight more than 30 Gb !!

dduportal commented 1 year ago
$ df -h /var/lib/jenkins/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  388G   79G  84% /var/lib/jenkins
root@ci:~# du -sh /var/lib/jenkins/jobs/Websites/jobs/jenkins.io
36G     /var/lib/jenkins/jobs/Websites/jobs/jenkins.io

=> the disk is used by the archived ZIP for each build. Let's remove them:

$ df -h /var/lib/jenkins/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  388G   79G  84% /var/lib/jenkins
$ du -sh /var/lib/jenkins/jobs/Websites/jobs/jenkins.io
36G     /var/lib/jenkins/jobs/Websites/jobs/jenkins.io

# Remove the ZIP archived files
$ cd /var/lib/jenkins/jobs/Websites/jobs/jenkins.io/branches && find . -type f -name "jenkins*.zip" -exec rm -f {} \;

# Result:
$ du -sh /var/lib/jenkins/jobs/Websites/jobs/jenkins.io
161M    /var/lib/jenkins/jobs/Websites/jobs/jenkins.io

$ df -h /var/lib/jenkins/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  352G  115G  76% /var/lib/jenkins
dduportal commented 1 year ago

This issue is closeable as we went under the 80% usage bar (requirement for good I/O performances).

A few improvement (to be treated as separated issues) as discussed with team:

dduportal commented 1 year ago

Closing the issue as operation is finished!

dduportal commented 1 year ago

Post-cleanup: @smerle33 ran an ncdu analysis, and found a 61 Gb tgz file in $JENKINS_HOME/.bkp dated from 1 year ago (25 August 2022). We removed it as not needed (and we have snapshot).

dduportal commented 1 year ago

Final status:

$ df -h /var/lib/jenkins/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  294G  173G  63% /var/lib/jenkins