We did a presentation on some anti-patterns we've seen used in umbraco sites. These are both sites that we've created and sites that we've inherited. I've converted the powerpoint into a PDF that you can look at if you are curious. Umbraco Anti-Patterns
One of the most interesting part of the presentation, to me, was the part where we did a little bit of light benchmarking of some of the ways that you can query umbraco for data. I wanted to post more background information about the data in our presentation and how we did our benchmarking, so everyone can have more context for that part of our presentation. The explanation below includes more research that we were able to do after uWestFest '17. I think it paints a more accurate picture.
All of the testing I did was from a website running on my laptop. The website had 13403 published nodes. 415 of those nodes were BlogArticles that I would query for in all of the ways that I could think of. For each type of query, I would follow these steps:
- I would put two copies of the query one after the other on an empty home page of the site.
- I would recycle the application pool.
- I would load the page initially (the first load after App Startup)
- I would load the page 4 more additional times without an app pool recycle
- I would check the logs for the timings and record them
What I was able to see was some info about how these queries performed the first time they were run after an app pool recycle AND how they would run on subsequent requests. I've included a screenshot of the data that I recorded and a zip of a bunch of the files I was using to do the benchmarking. The zip includes a couple of small files that helped me log my results to a separate log file and a view where I actually did all the querying:
The first thing I noticed is that both the Examine and the UmbracoHelper Linq queries take a really long time the first time they are run. After that, they speed up quite a bit and even begin to perform a little faster than the UmbracoHelper XPath queries, but I'd like to know exactly what is happening to cause the slow first load of all of the data. It would be interesting to run these tests on a much larger site. I hope to blog again with more learnings.