I put into production a "SoftPool" using hivemind and all the pages are stored using SoftReferences in the page pool. This change was very easy, there is a specific PagePool service in hivemind.
That far things are running very smoothly and the app hasn't climbed up to 95% of memory used (seems to run around 60% of mem). And I believe I also understood the reason. I discovered that tapestry dumps the size of the pagepool in exception pages and we have tracks of all of them in emails... After a day of run, the pool size was about 800 pages! And the real funkyness here is that there was over 20 locales! I guess people coming from search engines from all around the world and for each new locale there is a new engine created + pages. The pages stored in the pool are for a specific locale and so the more locales you have the larger the pool is. Also SoftReferences seem to really work the way you would expect it... The pool is kept but when memory gets low, the pool size gets reduced. With weak references, it is even possible to keep the memory very low... The app was gc'ed down to 80m of heap but WeakReferences seem to be gc'ed too agressively for a pool. I'm going to experiment some more sophisticated strategies by removing periodically pages that are not used often and I'll plug this pool for the engine service also. I don't want to keep engines for a locale that generates 1 visit a day or less... If anyone is interested I can post my code and my jar file (I deployed this change in a separate jar file). -- Thanks,
