Performance - What should I expect?

Topics: General
Jun 9, 2011 at 6:21 PM

I just deployed Orchard to our production environment, and I'm seeing the response for the HTML take anywhere between 600ms and ~1500ms. To put this in perspective the site we're replacing with Orchard runs on the same server, and is a standard (though very basic) asp.net site. The response for the page there is anywhere from 15ms to 60ms. 

I understand the complexities of the platform we're building on, but I was hoping to get somewhere between 100ms 300ms or less.

I've followed the recommendations here: http://www.orchardproject.net/docs/Optimizing-Performance-of-Orchard-with-Shared-Hosting.ashx. What is the preferred way of narrowing down performance issues? I'm capable and willing to track anything down, and even fix/submit-patches, I'm just hoping to get some info here so I can build on someone else's work instead of starting fresh.

Notes:

* We're running Orchard on top of sql 2008 on top of a pretty dang fast server, so I don't think that's the issue
* I am using a lot of content alternates http://d.pr/8EU9, I'm sure this can be reduced maybe have taken a shotgun approach to theme development. Not sure if that would adversely affect performance.
* I don't have much content on the site yet at all. On the homepage I do pull in 4 "Lists" of content items (recent blogs, testimonials, slideshow, products) and 3 Menus. But going to a blog post, where I'm just pulling in 3 menus only shaves off 10% or so response time.

Thanks in advance 

Coordinator
Jun 9, 2011 at 7:46 PM

During our performance testing of a default Orchard installation (using Sql Server), we see requests taking around ~100 to ~150ms on most pages. Things are slightly slower (~150 to ~200 msec) when using SqlCe.

Note that there is a significant difference between hitting a page the first time, and afterward (because views have to be compiled/loaded after the very first deployement). So, the first "hit" of a given page usually take >1 sec, and ~100 to ~150 msec after that. Note sure if the numbers you are reporting are "first hit" or not.

So, I would say the times you are seeing are not "normal". The only suggestion I have is to attach a profiler and see where is the bottleneck. As we are starting to see, Orchard having many extensibility points and 3rd party modules, it sometimes makes it "easy" to add a line of code somewhere which has a dramatic (negative) performance impact.

Let us know.

Thanks,

Renaud

Jun 9, 2011 at 7:53 PM

First hit is 3000 to 5000 msec, my numbers rule out those first hits. I'll attach a profiler and let you know.

FWIW, when I first did this test the only non-default-recipe modules I have installed and activated were

* Advanced Menu (Szmyd.Orchard.Modules.Menu)
* ImageField (Contrib.ImageField)

Also important to note that this is with "Shape Tracing" off 

Jun 9, 2011 at 10:09 PM

Hey, I did some profiling. I hope I did this right, I'm a bit new to it. I tried to remove as much as I could. Disabling alternates, modules, but retaining the little content I already had on the site. Using dotTrace, this is what is taking most of the processing time:

http://d.pr/f8NL

So, concerned about sql, I fired up sql profiler to look at the requests. Out of the 90-odd requests all were Duration 0, CPU 0.

Thoughts? I feel like blaming NHibernate, but it's weird that most of the CPU time is in a System.Data.SqlClient.

Jun 9, 2011 at 10:28 PM

A quick note here before you go wasting a bunch of time:

1. Fresh orchard, no modifications "default" recipe local w/ sql-compact: ~150ms response time

2. Fresh orchard, no modifications "default" recipe production w/ sql-2008: ~150ms response time

I'm going to start adding things one at a time to #2 from the site that's getting 600 to 1500ms and see if anything causes a big bump or if it's just everything involved.

Coordinator
Jun 10, 2011 at 12:14 AM

Thanks for the update. I'm not a expert in database performance, but I doubt NHibernate is the cause of these issues you are running into. Just a shot in the dark: could it be that there is somewhat high network latency between the web server and the sql server machine (it would mean each additional sql query in a web request would have a fixed time overhead). That would be consistent with time spent in SqlClient. We have seen issues with network latency on an Azure installation where the SQL Azure server and the Web Role server were incorrectly configued to run in different geographic regions.

Jun 10, 2011 at 4:03 PM

The screenshot I posted was my local -> vpn -> production sql so yeah sql overhead is definitely coming into play in the profiler. I should have mentioned that. I didn't want to install the profiler on our production machine.

----

But anyway, I was able to significantly speed up my Orchard deploy. This is what I removed:

* Advanced Menu (Szmyd.Orchard.Modules.Menu) -- I had 3 "menus" on the page
* Changed all lists to not filter or order on custom properties -- I had 4 "lists" on the page ordering and filtering this way

^ both of these seemed to be selecting/ordering/filtering off of non-indexed rows, and non-id rows. Specifically the advanced menu.

Also of note: my sql queries for a homepage load went from ~90 to ~75 when I removed the above items.

That's it. I'm now getting 300 to 400ms page response time (down from 600 to 1500ms). I wish it was more like 200ms, but I have a feeling once the team gets to Performance & Caching we'll see a dramatic improvement.