Good query execution time but page execution time too high

Events happening in the community are now at Drupal community events on www.drupal.org.
ghankstef's picture

We have a fairly high traffic site 1.5 million page views a month. The site uses a fairly standard Panels node override for displaying individual nodes. Left side gets node content such as title, content body and node comments. Right sidebar gets a latest stories block, an ad, and related stories block. Actually panels panes in most cases not blocks. We do run memcache and Varnish but we find that the traffic pattern always includes a number of uncached requests and scaling the site up mean delivering a single page as fast as possible.

Devel outputs this.
Executed 208 queries in 112.01 ms. Queries exceeding 5 ms are highlighted. Page execution time was 2039.75 ms. This is too slow

Slowest query is 5.24 ms so queries are not the biggest problem here.

Attached is a screen grab from XHprof and a callgraph.

It seems to me this is death by a thousand cuts. The slowest function takes 165 ms but there are 80, 000 functions called and the total of that just takes too long.

I'm not sure how to speed this up. Do I need to ditch panels, views and all the other nice Drupal tools and just code this up from scratch making sure each part is performant?

Any advice is much appreciated.

Thanks

AttachmentSize
XFProf by Wall time exc174.38 KB
Callgraph9.94 MB

Comments

Acquia Agent & Entity Cache?

mikeytown2's picture

Looks like the acquia agent module is causing the slow http request
acquia_agent_get_subscription()
What can you do to limit the number of http requests this module does?

Have you tried entity cache?
https://drupal.org/project/entitycache

It's not the Acquia Agent

jchin1968's picture

It's not the Acquia Agent module itself that is slow but your network or the Acquia server. The Exclusive Wall-Time is negligible for the various acquia_agent functions but quite high for the call to stream_socket_client() at 164.835 ms to open a connection.

The 3 calls to fread() at 135.390ms may or may not be an issue depending on the file size of the response and the network latency (i.e. distance) between your server and the Acquia server. 45ms on average per HTTP request doesn't really seem that bad.

HTTP requests, however, only account for 15% of the total execution time. There's other things that are contributing to the slowness.

Try running the Block Timer module (https://drupal.org/sandbox/jchin1968/2061005) on your development environment. It will highlight slow rendering blocks on a page and even blocks that are rendered in the background but not displayed.

Do you have Panel cache and

sagar ramgade's picture

Do you have Panel cache and View cache enabled ? Seems Memcached gets are really few.

Need Drupal help?
Reach Me

Share your Posts, Url, Sites
www.sociopost.com

what's the peak traffic?

tloudon's picture

1.5 million pageviews/mo may or may not break down into a lot of concurrent page requests/sec. is the site slow all the time or just during peak loads?

also, have you verified that varnish is caching or identified what URLs are missing? or could you increase the ttl or use content based caching (a la acquia purge)?

fwiw, unless you have some super traffic spikes, on a normal and properly configured site; i would think 99.9% of anon visitors are only having a speedy varnish cached experience.

if the site is marketplace.org, the ttl is 600 seconds. just clicking around, i got mostly quick response times but hit a number of cache misses. i noticed a couple of cache counts around 200, but most were lower in the 10s. i realize this is a news site, but if the traffic covers a normal distribution of URLs--i'd guess quite a few visitors get cache misses b/c of the 10m ttl. varnish could effectively be covering the homepage and a few top links here.

Selective cache clearing can

dalin's picture

Selective cache clearing can go a long way (if a new blog post is written, only clear the blog home page, etc.).

And then ESI (Edge Side Includes) to have different caching rules for different parts of a single page (e.g. the 'most popular' block probably doesn't need to be updated more than once an hour and is the same for every page on the site).

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

ESI Resources/Tips?

tloudon's picture

Hey Dave,

I haven't seen too many references to sites using the ESI module or sites using ESI in the wild period.

I set it up for one client that had huge traffic demands, but it took a lot of effort and was very difficult to debug. I ran into issues w/ module compatibility w/ ESI blocks, ESI panels, and IIRC context, etc--it's been over a year at this point, so I can't totally remember all the details. It was just a beast.

Anyway, I did see authcache 2-x is geared toward ESI tho and seem to remember hearing Symfony/D8 has solid ESI support. So it looks like there's some cool stuff on the horizon :)

Do you know of many sites running Drupal w/ ESI or any good resources? I'd like to catch up on the current-state--I may need it on a project here in the near future.

Thanks!

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: