Do you have any suggestions on how to speed up precompiling a Kentico site? AKA: the aspnet_compile

Lance Keay asked on September 18, 2014 10:50

Hi All, I have a Kentico 6 site that we have squeezed better performance out of by precompiling. We have a Team City Continuous Integration (CI) server that runs the build automatically on check in to the subversion repository.

However, the build takes 40 min! About 33 min are during the aspnet_compiler step! This is a pretty long time for a build that SHOULD take less than 10 min. I've gone through some of the various perf improvements such as moving the asp.temp files to a fast SSD. During the aspnet_compiler step, the server is using very little CPU, Disk and RAM. The CPU use seems to avg about 1%! In researching about aspnet_compiler, I have found many pages complaining about the speed, but a dramatic silence from Microsoft about it.

I've come to (perhaps erroneous) conclusion that if I can't speed up the aspnet_compiler, then perhaps I can reduce it's workload. Since Kentico has lots of controls in the project, are there any savings that I can glean by remove extraneous controls? ie: if I run the aspnet_compiler for a project with a single page, it's quick.

I've also thought about maybe making the cmsdesk a separate application that only needs to be compiled after a new hotfix has been applied.

Any ideas?

Recent Answers

Christian Nickel answered on September 18, 2014 17:26

If you absolutely have to use aspnet_compiler, then I think you answered your own question there:

I've also thought about maybe making the cmsdesk a separate application that only needs to be compiled after a new hotfix has been applied.

That is like what Kentico 8/8.1 does to help reduce the build time, but instead it has all the Kentico controls/pages in a single project and just your custom code in another project. Download it and install to see what I'm talking about.

We're not using the aspnet_compiler, we use a web application project and have MSbuild compile all our classes, etc. We have our Hudson CI server building all the Kentico 8.1 projects and our custom projects with MSBuild, it takes less than 30 seconds for everything including all our unit tests, this is on 7200RPM HDDs.

Realistically, how much time are you saving by pre-compiling with aspnet_compiler? Most of the commonly used controls are compiled very quickly by the server on the very first visit. I've never seen a big enough difference between the two styles to warrant using aspnet_compiler with any of our projects, just my experiences.

0 votesVote for this answer Mark as a Correct answer

Lance Keay answered on October 1, 2014 12:13

Thanks for the update - this is great news and another reason to upgrade from v6 to v8.

re: precompiled why? The initial page load time for some pages that are NOT precompiled can be 120+ seconds on a cold start without any temp files. Precompiled brings that time down to ~7 sec. It's a dramatic difference, but a very precise metric. Once the server is warmed up, inital page load (first visit to the page) may be 15+ secs NOT precompiled, down to ~5 if it's precompiled.

Since we like to deploy as frequently as we can, it is great to speed up the perceived site performance.

We looked at all the options for compiling and actually ran the same performance tests against various setups before we went down the precompiled route - precompiling IS a HASSLE. Avoid it if you can.

Note that we are compiling with fixed-names and compiling the .aspx/.ascx files too - so the site is not editable at all after precompiling. eg: you can't just change some code in a .aspx file without running the precompiler again.

0 votesVote for this answer Mark as a Correct answer

Martin Danko answered on November 24, 2014 19:15

Hello Lance,

We do not recommend to use precompiled website as from our perspective it usually doesn't provide so much better performance.. it's really just about the first page request and I believe this could be handled in a different way but our developers are already preparing some enhancements of precompilation as you can see also in the RoadMap on our website.

Limitations of precompiled websites

Only use precompilation to deploy completed websites. Precompiled instances of Kentico have limited website development features. You cannot edit, create or import virtual objects that contain ASP.NET markup and require compilation:

  • Page layouts (ASCX type)
  • Transformations (ASCX type)
  • Web part layouts
  • Form layouts (ASCX type)

If you wish to import physical files that require compilation (such as cs, vb, aspx, ascx), you need to run the import process on the original project, and then create the precompiled site again.

Best regards, Martin

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.