Performance tweak: Bulk creation of pages in EPiServer CMS 5

by: Per Bjurström

So, you are creating large amount of pages in code (1000+) and need to find ways of tweaking the performance? There is currently in EPiServer CMS 5 (SP2) a performance booster that you can use: Set PageData.UrlSegment yourself.

Why ? When EPiServer CMS automatically creates a UrlSegment(which is used in friendly URLs) it has to make sure that the segment is not used twice, that is done by looking at the peers. This is perfectly fine under normal conditions but since we are bulk creating pages we are actually invalidating the cache for the peers every time we publish a new page causing a reload for every publish which is expensive.

Creating UrlSegment yourself can of course be a bit complex if you don't have something unique to base it one. All pages with the same parent has to have a unique value for UrlSegment. For example if you have a unique ID from the source of your bulk data you could use that to guarantee unique URLs like "/MyBulkImport/New_blog_posting_4545", where UrlSegment in this case is "New_blog_posting_4545" and the other parts belongs to the parents. Another approach is to keep an internal list of assigned segments during the bulk process.

In my case I get a 45% performance boost when creating 2,500 pages. The values on the Y-axis are created pages per second. This is tested on EPiServer CMS 5 SP2, I can of course not guarantee that future versions behave identically when it comes to performance characteristics.

 

image

22 May 2008


Comments

  1. Of course! This makes perfect sense :-) I was wondering why page creation seemed to slow down after a 50.000. I'll definitely keep this in mind when I import Wikipedia. Good job!
Post a comment    
User verification Image for user verification  
Per Bjurström

About me

I'm a senior developer and architect on the development team in Stockholm and has been with the company since 1999. I live on Södermalm in Stockholm. My main focus areas are new technologies and how we can use them in our product development.

Messenger


Syndications


Archive


Tag cloud

EPiTrace logger