Performance Tuning

There are a number of new options available to help you tune Tapestry's internal configuration to better suite you particular applications scaling requirements. This section will go over what these options are and how to use them.

Page Pooling

The internal pooling of Tapestry pages now delegates the majority of actual pooling work to the commons-pool library. This means that your Tapestry application can now actually release idle pages from memory when they are no longer needed and hopefully increase the reliability/resources used of your production applications. All of the key configuration options are available in the HiveMind hivemind.FactoryDefaults configuration point which means that you can control these options via your servlet context parameters/.application file/hivemind/jvm system properties. The current options available are:

<contribution configuration-id="hivemind.FactoryDefaults">
    <default symbol="org.apache.tapestry.page-pool-min-idle" value="1" />
    <default symbol="org.apache.tapestry.page-pool-max-active" value="-1" />
    <default symbol="org.apache.tapestry.page-pool-max-idle" value="-1" />
    <default symbol="org.apache.tapestry.page-pool-evict-thread-sleep-minutes" value="4" />
    <default symbol="org.apache.tapestry.page-pool-evict-idle-page-minutes" value="40" />
</contribution>

This configuration is based around using the GenericKeyedObjectPool implementation in particular. The key used to store each Tapestry page is a combination of the pageName and Locale of the page. The meaning and use of each value is as follows:

  • org.apache.tapestry.page-pool-min-idle - The minimum number of page instances that must not be evicted for a given key. The default value of 1 means that we want at least one instance of each unique page to be available at any given time.
  • org.apache.tapestry.page-pool-max-active - The maximum number of total pages that may be active in the pool. The default value of -1 indicates an unlimited number.
  • org.apache.tapestry.page-pool-max-idle - The maximum number of idle pages that can exist in the pool. The -1 value here also means unlimited. (but doesn't mean they won't be evicted)
  • org.apache.tapestry.page-pool-evict-thread-sleep-minutes - This pool launches a seperate thread which is responsible for managing and evicted expired pages from the pool when appropriate. This value controls the number of minutes this thread should sleep before checking for expired pages.
  • org.apache.tapestry.page-pool-evict-idle-page-minutes - The number of minutes that a page must be idle for before being eligable for eviction from the pool.