Description
Some containers such as tomcat, implement the ServletContext getAttribute method with synchronization on the attribute object or the attributes map. In beehive NetUI, the URL template factory and the formatter used for rewriting are cached as attributes on the ServletContext. This would be a bottleneck under a large load for an app with pages that require lots of URL rewriting (I.E. lots of NetUI anchor tags, etc.). For each href or URL that needs to be written in a single user request, the URL rewriting gets the ServletContext attributes for the template factory and formatter.
To improve performance, the URL template factory and formatter could be set as attributes to the request. Then, the URL rewriting could get the template factory and formatter from the individual request and minimize the conflict with multiple user requests and the synchronization at the ServletContext attributes. Note, we still need to cache these objects globally as attributes on the context but at the start of processing a page flow request, the objects could be pulled from the context and added to the request.