Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-14875

It takes aeons to delete large workspace on slow disks

      I've several directories (say, a,b,c,d and e on the top level. They're quite capacious inside with many nested levels. I need to delete all but two.
      I set exclude to "a" and "c" and the cleaning process takes very much time, rm -rf works much faster, so i assume it's not a general performance issue.

      I don't want to look what the algorithm is, but maybe it's not optimal if it tries to check any pathname. On the other hand maybe i should write something like a/** and c/**?

          [JENKINS-14875] It takes aeons to delete large workspace on slow disks

          Update. The same setup.
          I have a workspace like:

          [hudson@lnx10 SVFE-Basic]$ ls -1p
          autotest/
          Describes the process of automatic test SmartVista.doc
          emulators/
          sv_2_12_0_20120821_Lx86_64~2.6.18-194.el5~2.5~102/
          svfe/
          sv_instance/

          When i set the clean-ws like:
          include sv_2*
          include svfe
          include sv_instance
          and mark the "directories" checkbox, the workspace is not being cleaned at all.

          But if i leave only "include svfe", it works as expected: cleans svfe directory.

          I suspect i do something improper but cannot deduct what…

          Yury Pukhalsky added a comment - Update. The same setup. I have a workspace like: [hudson@lnx10 SVFE-Basic] $ ls -1p autotest/ Describes the process of automatic test SmartVista.doc emulators/ sv_2_12_0_20120821_Lx86_64~2.6.18-194.el5~2.5~102/ svfe/ sv_instance/ When i set the clean-ws like: include sv_2* include svfe include sv_instance and mark the "directories" checkbox, the workspace is not being cleaned at all. But if i leave only "include svfe", it works as expected: cleans svfe directory. I suspect i do something improper but cannot deduct what…

          Yury Pukhalsky added a comment - - edited

          An observation.
          One of the nodes is on the NFS disk (btw, it's lnx10 from the previous comment), and clean-ws doesn't delete the files, albeit on the other nodes it does. The configuration is the same, it's matrix job.

          Yury Pukhalsky added a comment - - edited An observation. One of the nodes is on the NFS disk (btw, it's lnx10 from the previous comment), and clean-ws doesn't delete the files, albeit on the other nodes it does. The configuration is the same, it's matrix job.

          vjuranek added a comment -

          Hi,
          it can be an issue in apache DirectoryScanner or and issue in Jenkins core whicih deletes the directories. My tip is, that it's and Jenkins core issue as it deletes directories recursively so if you have a capacious sub-directory structure, I can imagine it takes quite a long time to delete it. Could you please run a test job without any filter and check how long it takes to delete this structure without nay filter to be sure that the issue is in way how Jenkins deletes the directories? Thanks and sorry for the delay to response this issue.

          vjuranek added a comment - Hi, it can be an issue in apache DirectoryScanner or and issue in Jenkins core whicih deletes the directories. My tip is, that it's and Jenkins core issue as it deletes directories recursively so if you have a capacious sub-directory structure, I can imagine it takes quite a long time to delete it. Could you please run a test job without any filter and check how long it takes to delete this structure without nay filter to be sure that the issue is in way how Jenkins deletes the directories? Thanks and sorry for the delay to response this issue.

          I cannot…
          Unfortunately the setup has long been demolished.

          Yury Pukhalsky added a comment - I cannot… Unfortunately the setup has long been demolished.

          vjuranek added a comment -

          never mind, once I have some spare time, I'll try to reproduce.

          vjuranek added a comment - never mind, once I have some spare time, I'll try to reproduce.

          We have this problem in our build setup too.

          I think the fastest solution regarding performance to this problem is to use a move operation first:

          Moving a folder on a filesystem is in general a lot faster than deleting a folder structure (like x1000 for deep folder structures).

          Can the plugin be modified to create a .purgatory folder (maybe in the Jenkins home) and simply move the "workspaces" to be deleted into that folder?

          The actual deletion could be run in the background on the .purgatory then, making it much faster.

          What do you think of this?

          Matthias Bechtold added a comment - We have this problem in our build setup too. I think the fastest solution regarding performance to this problem is to use a move operation  first: Moving a folder on a filesystem is in general a lot faster than deleting a folder structure (like x1000 for deep folder structures). Can the plugin be modified to create a .purgatory  folder (maybe in the Jenkins home) and simply move the "workspaces" to be deleted into that folder? The actual deletion could be run in the background on the .purgatory  then, making it much faster. What do you think of this?

            olivergondza Oliver Gondža
            aikipooh Yury Pukhalsky
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: