Performance tuning

This chapter describes some recommended settings for improving the overall performance of WebCmsModule.

URL resolving

The mapping infrastructure (eg. @WebCmsPageMapping) has as a drawback that any request will be matched against all registered WebCmsUrl entries. It is strongly advised to configure the WebCmsUrlCache to cache these lookups, as well as to limit the request paths for lookup if you can do so.

By default all requests will be matched against the WebCmsUrl collection. You can control which requests should be matched by specifying one ore more ANT path patterns in the relevant settings.

URL resolve path properties

Property

Description

webCmsModule.urls.included-path-patterns

Paths to be included for WebCmsUrl mapping. If empty, all non-excluded paths will be considered. If not empty, only requests matching one of these paths will be mapped to a possible WebCmsUrl.

webCmsModule.urls.excluded-path-patterns

Paths to always be excluded from WebCmsUrl mapping. If empty, only included paths will be considered. If not empty, requests matching these patterns will be excluded, even if they match the included patterns.

WARNING

If URL resolving is disabled for a particular path, @WebCmsEndpointMapping handler methods that use a WebCmsUrl with that path will never match. Disable URL resolving only if you are sure you will handle all requests for these paths manually.

Caching

WebCmsModule uses some specific caches to improve performance. It is recommended to configure these caches in any production application.

WebCmsModule custom caches

Cache name

Description

WebCmsUrlCache

Maps request paths to matching WebCmsUrl instances. Only caches the url id, requires 2nd level cache enabled for optimal performance gain.

WebCmsMenuCache

Caches the menu structure that should be generated from corresponding WebCmsMenu items. Prefer to cache these for a long time if possible.

WebCmsDomainCache

Relevant in a multi-domain setup. Caches domains and their metadata. Domain lookups happen on pratically every request so this cache is very important. Domain settings are usually quite static, so caching for a very long time is often feasible.

Hibernate level 2 cache

To improve overall performance of the domain model, configuring Hibernate level 2 cache is also strongly advised.

The cache names for the Hibernate level 2 cache are always fully qualified class names. The prefix c.f.a.m.w.d stands for com.foreach.across.modules.webcms.domain.

Cache name

Hints

c.f.a.m.w.d.url.WebCmsUrl

Holds WebCmsUrl entity data. The size of your WebCmsUrl cache should be a multiple of your WebCmsEndpoint cache and a minimum of one-to-one, as usually there are multiple urls per endpoint.

c.f.a.m.w.d.endpoint.WebCmsEndpoint

References WebCmsRemoteEndpoint and WebCmsAssetEndpoint. Size this cache according to the number of redirects or assets you expect to be frequently accessed. Depending on your application setup a good guideline is at least the size of your WebCmsAsset cache. If you use a lot of redirects, you should provide some additional space.

c.f.a.m.w.d.type.WebCmsTypeSpecifier

The items in the WebCmsTypeSpecifier cache can usually be cached for a long time, because they do not change often.

c.f.a.m.w.d.asset.WebCmsAsset

The size and duration of your WebCmsAsset cache depend on how you use them. If you do not change existing assets often, you should opt for a longer duration.

c.f.a.m.w.d.domain.WebCmsDomain

The items in your WebCmsDomain cache are usually very static and are accessed frequently. It’s usually best to cache these for a very long time.