PreCompiled XSLT, ReBase and NGEN RRS feed

  • Question

  • Advanced performance question here.  Here's my scenario:

    I have a database that contains thousands of XSLT documents.  One for each page of a website so these translate XML into HTML.  An ASP.NET web server (farm) loads the XSLT documents from the database and uses them to render HTML for each web request.

    I've implemented the optimization of using XslCompiledTransform and caching it between database refreshed (every 30 minutes).  I'm looking to notch performance up further by pre-compiling the XSLT to DLLs with xsltc.exe.  This is supposed to eliminate all the Dynamic Method Invocations that XslCompiledTransform creates.

    So, I have a separate server writing the XSLTs to files and running through them with xsltc.exe. Takes about 20 minutes but that's OK.  I then drop the DLLs onto each webserver.  Now I can just have the webserver dynamically load the DLLs on an as-needed basis.  Here's the code I'm using to load the assembly into XslCompiledTransform:

    byte[] bytes = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XsltDlls\\" + fileName + ".dll"));
    Assembly assembly = Assembly.Load(bytes);
    Type type = assembly.GetType(fileName);
    XslCompiledTransform compiledTransform = new XslCompiledTransform();

    Shoud I ReBase.exe the DLLs in the directory and/or NGEN.exe them?  ReBase takes about 5 minutes and NGEN.exe with /queue will take about 10 minutes during which CPU is hit hard - likely causing an impact to the traffic serving function of the webserver.  Given how I'm loading the assembly by reading bytes from the assembly will the native NGEN image even be referenced or will the JIT fire up anyway?

    Any/all insight into this will be MUCHLY appreciated!


    • Edited by mvr1 Friday, November 19, 2010 7:37 PM typo
    Friday, November 19, 2010 7:31 PM


All replies