First of all, I lie, it’s not really a plain jsp website. It has a couple of pages with database access and a lucene based search engine… and around 400 standalone jsp pages.
The problem is that the admins on a production server we’ve not access to, say that the site is consuming too much memory (200+ Megs), and we are probably facing a memory leak, because it forces them to reboot it.
I’m not a jsp expert, but I suspect that it’s not really a memory leak, and that the database pages and the lucene search have nothing to do with this issue. I understand that each jsp page is compiled to a java class, then executed, and kept in memory for later access.
The real question is: Can this elevated (for 400, i think yes) number of standalone jsp pages cause the memory usage to grow up to 200M?
And if yes, how would you lower the memory usage? Using SSIs for includes (avoiding the use of jsp pages for that purpose) could be an option?
Thanks in advance
Half a megabyte per JSP is not what I’d usually expect. Obviously, one can write any code one likes in a JSP so a compiled jsp can be huge and can allocate huge amounts of memory, but assuming that these are conventional JSPs then I’d me most suspicious of run-time behaviours rather than the shear number of JSPs.
One possibility is that you have a lot of session data. As users move from page to page the session size might be increasing. It’s quite common to see data retrieved from a database temporarily place in a session so that it can be used in another page. If that doesn’t get tidied up you can rapidly consume lots of memory.