Saturday, 1 March 2008

EPiServer 5 vs. EPiServer 4.61 part I - GetPage()

We have been using EPiServer 4.61 intensely for over a year now, during this time we have managed to deliver a few successful projects on this platform. It took us some time to learn how to use EPiServer effectively. Release of EPiServer 5 was welcomed by us very enthusiastically. All the new features and improvements were very promising. But before porting our EPiServer 4.61 applications to newer version we wanted to check what can we expect from EPiServer 5.

With version 4.61 we were facing many performance issues and we were forced to cache lots of data on our own to meet performance requirements. (you can read more in Adam's article)Therefore we have decided to check how fast/slow EPiServer 5 is. Good place to start is a method which is absolutely essential for all developers – Global.EPDataFactory.GetPage(). This method retrieves a PageData object with information about a page from either database or cache. It’s quite hard to use EPiServer and don’t use this method ;)

Preparation

First of all I generated 22k dummy pages. Structure of generated pages and used page types was the same as we use on production servers. All page IDs were stored in an external text file. In each run, test was loading arbitrary pages, it was using only IDs from the text file. Having all IDs in an external file, it was possible to load pages right after starting server. This way I got the times which are required to load pages from a database.

Test scenarios

  1. In first scenario IIS server was just restarted which means that cache was clear and all requests were forcing EPiServer to retrieve pages from a database.
  2. Second scenario was an opposite to the first one – all pages were loaded earlier, which effectively means that all data was cached.

Additionally I was checking how dynamic properties influence overall performance. All tests for both scenarios were done first without dynamic properties and secondly with 25 dynamic properties set.

Results

First Scenario:



Results show that loading pages from a database is much faster in EPiServer 5. It took EPiServer 4.61 significantly more time then EPiServer 5 to return 15k pages! Version 4.61 needed 140 seconds whereas version 5 only took 20 seconds.

An interesting fact is that dynamic properties in this case didn’t change times almost at all on both versions. Which is understandable barring that the page has to be read from the database anyway.

Second scenario:



Again EPiServer 5 beats EPiServer 4.61 severely. EPiServer 4.61 cache uses “copy-on-read” approach, in version 5 cache data are read-only. It means that by default we are getting read-only objects from cache. Developers need to call different method to get modifiable copy of the object (EPiServer.Core.PageData.CreateWritableClone) but honestly, as a developer, I can live with that, it’s much more important for me that the cache works much faster for the regular viewers!

There is another interesting conclusion … if your pages are loading slow in EPiServer 4.61 try to get rid of dynamic properties … you can get quite nice speed up thanks to that!

Well, there is no need to write much … GetPage() is hell of a lot faster in EPiServer 5. In the next part I will check if GetChildren() behaves in a similar way.

2 comments:

Allan Thræn said...

Great Post! These are numbers I like to see.
And welcome to the blog'o'sphere, Marek!

Anonymous said...

Great post Marek! I'd love to see more of this.