I am creating a simple query by combining few criteria to get the page id .The code for the method is as below. The issue is while monitoring the performance of the website the method is taking long time for the first time but for the subsequent hits its taking negligible time. The result are as below 1 2 3 4 5 6 7 8 11388.322 5.548 7.426 4.099 11.376 4.17 3.938 4.813

All times are in ms and i have recycled the app pool for the first time, application caching is off but tridion object cache is on (though i believe creating query has nothing to do with tridion object cache, Please correct me if i am wrong)

public static Query GetPageContentFor(int publicationId, string pageUrl)
        var pageUrlCriteria = new PageURLCriteria(pageUrl,Criteria.Equal);
        var pubCriteria = new PublicationCriteria(publicationId);
        var finalCriteria = new AndCriteria(pageUrlCriteria, pubCriteria);
       return new Query(finalCriteria);

Regards, Rajendra

  • Please add information regarding how you are measuring the performance of this code and when this code is executed. If you have just recycled the app pool and this is executed on the first request, there are MANY factors that could be adding time here, which are not necessarily anything to do with the Query object or perhaps even Tridion! Apr 25, 2013 at 10:27
  • Hi David, I have deployed the website in IIS and using ants performance profiler to measure the time taken aby all methods. for each iteration i am refreshing the page and collecting the time taken from the tool.The code is executed by a call from the ui layer on the home page through data access layer Apr 25, 2013 at 10:52
  • Great. After recycling the Application pool is this the very first page you request? Are there other pages on the site you can measure? One which is totally static? One which has some Tridion CD functionality but not a Query object? You need something to compare your measurements against. Are you able to measure the creation of each Criteria object? Apr 25, 2013 at 11:03
  • Yes, this is the first page after recycling as i want to test various scenario like the first hit then subsequent hit in small interval and lastly a hit with long duration >10 min. I cannot measure each criteria but i can measure all the methods along with their child methods. By any chance does the method that i mentioned involve object caching? Apr 25, 2013 at 11:10

2 Answers 2


As far as I can see, you're not doing anything unusual in your method.

In order to support both .Net and Java environments the Tridion Content Delivery API is built in Java and JuggerNet is used to expose it to .Net. This means that each Application Pool in a .Net environment actually hosts a Java Virtual Machine.

I suspect that it might be the starting up of this JVM that is taking the time on initial request, especially as you have recycled the Application Pool (This is kind of the long-winded, slightly lower level way of explaining what Nuno already said in his answer). I'm not sure that you'd be able to do much to improve this other than boosting processing power and/or memory of the server.

How important is the response time of the initial request after recycling the Application Pool? Most website applications I have encountered take some time to start up upon the first request. Is this a realistic test? Most performance testing I have seen allows for, or at least takes into account initial startup of the application. How often do you expect to see your Application Pool recycle in production?

  • Thanks David,I recycled the app pool to clear all cache so that i can capture all the scenario from start. This will not happen in real environment and site will be recycled except maintainence. Apr 25, 2013 at 11:29

There are many things that happen on the very first request to Tridion:

  • Storage layer gets initialized (not a small task)
  • Most of Tridion gets initialized (depending on what you're asking)
  • Cache gets initialized

On a second request none of this needs to happen, plus your query results are probably cached by now (if cache is correctly configured).

  • Thanks Nuno, The method that i mentioned above, does it get cached as well because the time that i am getting is the execution time of that particular method which doesnot contain anything which can be cached. Apr 25, 2013 at 11:13
  • 2
    Query results themselves are cached (if caching for Query item type is enabled). Apr 25, 2013 at 11:16
  • 1
    I don't think there's anything TO cache in your method. All you're doing is creating some Criteria and a Query object, not executing it yet. I think this is all just API initialisation time Apr 25, 2013 at 11:18
  • You're right David...it is just part of the time Tridion needs to initialize. It's not even all the init time as more time will be spent the first time the query fires to the DB. Apr 25, 2013 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.