Hi! 

We had some issues with Jenkins last days and after some profiling I found 
that root cause is how Jenkins perform log rotation. 

LogRotator.java (1.609.3):
        if(numToKeep!=-1) { 
            // Note that RunList.size is deprecated, and indeed here we are 
loading all the builds of the job. 
            // However we would need to load the first numToKeep anyway, 
just to skip over them; 
            // and we would need to load the rest anyway, to delete them. 
            // (Using RunMap.headMap would not suffice, since we do not 
know if some recent builds have been deleted for other reasons, 
            // so simply subtracting numToKeep from the currently last 
build number might cause us to delete too many.) 
            List<? extends Run<?,?>> builds = job.getBuilds(); 
            for (Run r : copy(builds.subList(Math.min(builds.size(), 
numToKeep), builds.size()))) { 
                if (shouldKeepRun(r, lsb, lstb)) { 
                    continue; 
                } 
                LOGGER.log(FINE, "{0} is to be removed", r); 
                r.delete(); 
            } 
        } 

I think it's much better to keep "numToKeep - X" or "numToKeep + X" jobs 
instead of loading and processing all builds. 
Because now it creates a huge... HUGE... memory footprint: 


Maybe it's possible to change this behavior? Create a additional option or 
something like that? Because right now we have only one solution - use date 
based rotation instead of number of builds based. 

Br, Alex 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/3f81fc36-efd7-4cc7-a1d0-0b908f19542a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to