I'm trying to troubleshoot a problem and I'm hoping you could help me with the method :) Hopefully this could also benefit other people.
I have a Jenkins server running (v2.46.2). For some reasons, when browsing the Web UI, some requests are very very slow (up to 10 minutes). It seems to be especially the case when loading the UI a first time. Then, it is in general very responsive. If you wait maybe 10/15 minutes, the first request will be very slow again. And then pretty fast for a while.
How would you go to troubleshoot this? So far this is what I did:
- Checked general stats of the host (cpu, ram, etc). All looks ok.
- Checked the stats of the Java VM. Memory usage looks ok to me.
- Set up better monitoring to track nb of incoming request, time to process them and status code. This showed indeed that some requests get delayed (up to 10 minutes).
I've read a number of interesting things from the internet including: Jenkins GUI only shown after waiting for 2 minutes. In this case, the info is a bit old (outdated?) and as my jobs only keep a limited number of builds, it did not help much.
This blog post was also super interesting: https://jenkins.io/blog/2016/11/21/gc-tuning/. In my case I am not convinced the problem comes from garbage collection.
I am left with a number of hypotheses such as:
- I am using a lot of Categorized View (with regexp), maybe it is inefficient? But it doesn't seem enough to explain minutes of delays.
- The fact that only the first page is long to load make me thing some caching is involed. But is it caching of html? Of credentials? Etc.
At the moment, these are only guesses. Ideally I would like to somehow profile the time spent by the server to answer requests. And from there try to find where this time go.
Is this possible at all? I tried using VisualVM, but this only show global data right? Is it possible to isolate the resources used to answer a request? How would you approach it?
Note: I am discovering the Java world (coming from Python) so please do not assume I know well how the Java VM works or the tools you use :-)
Thanks a lot!