On 21/07/2025 17:48, Daniel Sheridan wrote:
On 18/07/2025 16:04, Daniel Sheridan wrote:
I definitely think there is something happening on the Tomcat side here around
caching, I've played with some resource caching settings but it didn't make any
difference unfortunately.
The flame graph is showing that Tomcat is having to reload the JAR indexes that
it uses to find files in JARs (so Tomcat doesn't have to search through every
JAR every time it needs to load a new class).
That index gets removed (to reduce memory footprint) periodically if it isn't
being used. By default this check happens every 10 seconds.
To speed things up try experimenting with the archiveIndexStrategy of the Resources
element. I suspect you'll want to use "bloom". You will likely see a larger
memory footprint but you should also see less (no?) delays.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
Hi Mark,
I've tried this out and after some initial testing I am seeing improvements!
I'll be doing some more extensive testing this week, but I'm not seeing the
delay so far.
On monitoring I don't see any noticeable increase in memory usage so far, but
that would be somewhat of a concern if increased memory usage is possible.
Would you have any idea of how much of a potential memory increase moving from
the default setting to bloom could cause, and if it would be just in the short
term until the indexes are eventually removed?
Memory usage will be <1kB per JAR file. So for most web applications
that will be in the noise. In your case, you'd be looking at less than
200kB.
With "bloom" the indexes are never removed so the memory is used until
the web application stops.
I assume that the bloom filter has a longer interval between the index checking
like you described, so the indexes aren't removed as often?
There is the option to use "purged" which will clear out the bloom
filters regularly. The check is every 10s by default and if a JAR is not
being used, the corresponding bloom filter is cleared.
Given the low memory usage and associated performance benefits, I think
there is a case for making "bloom" the default for Tomcat 12 onwards.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org