On Fri, Nov 15, 2024 at 12:38 PM Scott McCarthy < scott.mccar...@clarivate.com> wrote:
> Hi All, > Hello! > We are running a fairly large Tapestry application with hundreds of > concurrent users. > When under load, we are occasionally seeing an instance go into deadlock, > whereby the Tomcat threads max out, but the CPU is virtually zero. > This can commonly occur when a new instance starts up under heavy load, > but can also happen on an instance that has been running for several days. > Tapestry creates pages instances on demand by default, so I guess the problem here is deadlocks while the somewhat complex project that is involved in getting the pages assembled. A possible simple solution you can use right now is to preload all pages when in production mode, so your webapp only takes requests when all the pages are already assembled. Something like this in your AppModule or other module class, not tested, but I hope is enough to give you a good idea: public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration, PageSource pageSource, @Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode, ComponentClassResolver componentClassResolver) { if (productionMode) { for (String pageName: componentClassResolver.getPageNames()) { pageSource.getPage(pageName); } } } This will add some time to the webapp startup process, but it's a tradeoff with fixing the threadlock problem. Please let me know if this works. One of my future plans is to add support in Tapestry for eager loading everything possible (page instances, services, assets, etc) so, when the webapp starts accepting requests, everything is ready and the first requests aren't slowed down by initializations. Cheers! -- Thiago H. de Paula Figueiredo Software developer/engineer Apache Tapestry consultant, committer and project management committee member You can sponsor my work on Tapestry at https://github.com/sponsors/machina-br