Skip to Content

Some performance hints from our project experience.

During reviews of several custom codings of Knowledge Management Flexible UI components, I often recognized performance-impacting coding pitfalls. I’d like to show here some general improvements you should use to avoid time-consuming calls to the Knowledge Management’s repository framework (RF) within your Flexible UI components.

Reuse of information within your component

Having implemented UI components like collection renderers, property renderers etc, you often have to retrieve resource-related information from the RF. Most of the UI component methods already provide this information to the implementing method:

     public class SimplePropertyRenderer implements IModelledPropertyRenderer

          public Component renderProperty(IProperty prop, IMetaName metaname, IResource r, IProxy proxy, IParameters p) throws WcmException {

Avoid retrieving IResource objects from the RF via RepositoryFactory calls within your UI components:

     IResource res = ResourceFactory.getInstance().getResource(...);
     IRID rid = res.getRID();

Use the local reference to the resource object passed by the method instead.

     IRID rid = r.getRID(); // r is the local referenced variable

Resource’s content and properties calls are expensive if you retrieve them always directly from the RF:

     IProperty p = r.getProperty(PropertyName.createDisplayName());
     // do something with p …
     p = r.getProperty(PropertyName.createLastModified());

      Try to use the IProxy or the PropertyAmalgamation mechanisme, which optimize the calles to the RF:

     IProperty p = proxy.getAmalgamation().getProperty(r, PropertyName.createDisplayName());


Use mass calls

If you have to process multiple objects of the RF, e.g. properties, try to use mass-calls, when ever it is possible:

     IPropertyNameList nl = new PropertyNameList();
     IPropertyMap propMap = proxy.getAmalgamation().getProperties(r, nl);

Or if you have to call the RF directly use the mass-call operation of the ResourceFactory object.

     IRidList rl = new RidList();

     IResource res = ResourceFactory.getInstance().getResources(rl, ...);

Useful utility class ResourcePropertyAmalgamation

The ResourcePropertyAmalgamation is located in the Java package com.sapportals.wcm.rendering.base and caches property calls against the RF. An instance can be get through the IProxy implementation:


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Dagfinn Parnas
    You have a tiny error in the code at the end
    IResource res = ResourceFactory.getInstance().getResources(rl, …);
    should well be
    IResourceList res = ResourceFactory.getInstance().getResources(rl, …);

    It would be interesting to get some blogs on the customization customers have done on KM using the API.


  2. Former Member

    I’m experiencing performance problems while running a property search on a CM repository holding more than 100.000 of documents. My code looks like the following:

    IRepositoryManager repositoryMgr = start.getRepositoryManager();
    IPropertySearchManager searchMgr = repositoryMgr.getPropertySearchManager(start);
    IQueryBuilder queryBuilder = searchMgr.getQueryBuilder();
    IQueryExpression queryExpr =
      queryBuilder.eq(propName1, propValue1).and(
      queryBuilder.eq(propName2, propValue2).and(
      queryBuilder.eq(propName3, propValue3).and(
      queryBuilder.notEq(propName4, propValue4))));
    IResourceList result =
      Integer.MAX_VALUE, // maximum depth
      Integer.MAX_VALUE, // maximum result size
      false // don’t include versions

    It takes about 2 minutes to work out the search, really to much for a production environment. There’s something I can do to speed up this search?

    Thanks in advance.

    Pasquale Capuano


Leave a Reply