Complex site, Slow Drupal - Is this normal?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jvieille's picture

A quite complex site - nearly 400 modules is getting seriously slow.

For example:

this page https://www.see.asso.fr/ree
Executed 2923 queries in 925.65 milliseconds. Queries taking longer than 100 ms and queries executed more than once, are highlighted. Page execution time was 7228.93 ms.
http://xhprof.shareontheweb.com/?run=50ed0ffe87d9c&source=SEE&sort=excl_wt

Module page load
Executed 4957 queries in 1139.61 milliseconds. Queries taking longer than 100 ms and queries executed more than once, are highlighted. Page execution time was 9312.87 ms.
http://xhprof.shareontheweb.com//index.php?run=50ed1181c1498&source=SEE
Module page save
Executed 27978 queries in 16461.22 milliseconds. Queries taking longer than 100 ms and queries executed more than once, are highlighted. Page execution time was 303082.09 ms.
http://xhprof.shareontheweb.com//index.php?run=50ed144bdd532&source=SEE

Attached the module page after save, showing all modules and devel results.

Shall I seek better or Is this normal taken into account this configuration and only increasing the server power (already 8 cores2,4Ghz, 12GB)or shrinking the number of modules would make it?

Thanks

Comments

Large TTFB on live test

Peter Bowey's picture

The TTFB (Time to First Byte) is larger than normal = 0.738s

See you test result page here: http://www.webpagetest.org/result/130109_SS_78V/1/details/

A long TTFB usually is caused by slow responses via the database, and/or excessive modules (modules that effect the final html sent).

Also some of your css assets are a bit slow loading. This one in particular:

Request #6
Details Request Response
URL: https://www.see.asso.fr/sites/see.shareontheweb.com/files/advagg_css/css...
Host: www.see.asso.fr
IP: 87.98.176.200
Location: France
Error/Status Code: 200
Start Offset: 0.935 s
Initial Connection: 59 ms
SSL Negotiation: 87 ms
Time to First Byte: 122 ms
Content Download: 2007 ms
Bytes In (downloaded): 35.1 KB
Bytes Out (uploaded): 0.6 KB

2 seconds to load a 35.1Kb style-sheet?

The actual Start Render time (browser side) = 3.357s
Document Complete Time = 5.899s
Fully Loaded Time = 5.946s
Data Sent: 642 KB
DOM Elements: 881

The test was performed From: Paris, FR - using IE8 - DSL

Most of this points to a excess number of modules. I trust you are using APC - at least (for PHP cache benefits)?

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

I would concentrate on the big issues first

MJD's picture

From Peters test result above the biggest issue is that css, js & images (ignoring the bit_cache ones which is the next biggest problem) are taking much longer to download than you would expect for their size... direct calls to the 35kb css file via my browser address bar are immediate and not the 2 seconds when the whole page is called...this delay means other requests are queued and therefore affect the document complete time...

Drupal , php etc have finished their work at this stage in less than a second...shaving time off that sub second initial response is a secondary issue... so as per my title I would fix the big issues first!

Fix the download speed and your page load time should be approx 3 secs without any further work...

Modules cleanup needed

julien's picture

Hard to believe that 400 modules are needed to achieve this website, even with solr, organic group, or i10n features. The custom modules code have to be checked too, maybe it has to be refactored for faster execution.

Like Peter commented you MUST

wipeout_dude's picture

Like Peter commented you MUST have APC enabled as a first step to optimisation..

Make sure your database is tuned and query caching is enabled..

Do you REALLY need all those modules? Review the modules you are using and see if you can reduce them.. There is often a number of ways to achieve the same result.. Simply throwing more modules in is easy but will hurt performance of the site..

With that many modules I would suggest using drush to manage them rather than the modules page which I imagine is ridiculously long now..

How much memory do you have on your server?

Massive amount of modules

tayzlor's picture

Massive amount of modules will be hurting you (you have a huge amount of function calls per page). From your xhprof runs it also looks like you are using Panels, but you dont have any panel caching enabled (see time spent in panels_render_display and other panels_ functions). You will need to go in and configure your panels displays to use caching, which should give you a significant boost.

You will also want to do the same for views.
For caching you'll want to make sure you have APC on, and i'd recommend also using either Memcache or Redis, which should also give you a boost.

Also, that is an awful lot of mysql queries you have per page. You will want to see if you can disable any modules you have enabled, and also turn on the devel module and output the query logs for the page. Examine any unecessary queries or where anything can be cached (to use cache_get).

Yes, APC is in use with

jvieille's picture

As indicated above, the server is 8 cores2,4Ghz, 12GB RAM
APC is in use with cacherouter, 1 GB with all cache tables redirected to it + advagg, boost,
I worked on LMySQL, including switching to innodb, but never seen much change.
munin information available here
http://188.165.208.179:88/munin/kimsufi.com/ks312228.kimsufi.com/index.html

I intensely look at webpagetest to check the numerous things I try to improve this.

I can certainly remove a couple of modules, but not many - the site is a sophisticated collaborative platform behind its public display, and functionaliities keep adding up.
It has also Unbercart e-commerce feature, with many modules to achieve complex pricing (multi-VAT per product, quantity discount, kits, conditional shipping conditions...)
There are no custom modules at this point.

However, the anonymous browsing is acceptable, mmost pages load in 1 second.
I am concerned for logged in users. I would think about authcache, but this might have some side disagreements.

Lots of time spent at

Martijn Houtman's picture

Lots of time spent at drupal_lookup_path in http://xhprof.shareontheweb.com/?run=50ed0ffe87d9c&symbol=db_query&sort=...

A bit further gives that the special_menu_items module using loads of time: http://xhprof.shareontheweb.com/?run=50ed0ffe87d9c&symbol=call_user_func...

1 second for cached,

Martijn Houtman's picture

1 second for cached, anonymous pages is not OK.

Large Complex Site - Split it up

davidmac's picture

Have you considered splitting the site across several drupal installations or a multi site setup, for example the e-commerce side could sit in its own installation on a seperate subdomain.

Also on this page https://www.see.asso.fr/prix_distinctions. you are scaling images from very large sizes to thumbnail size, you could improve this significantly.

Speed test result:
https://www.see.asso.fr/sites/see.shareontheweb.com/files/editorimages/D... is resized in HTML or CSS from 1600x1071 to 130x87. Serving a scaled image could save 345.2KiB (99% reduction).

Removing special_menu_item

jvieille's picture

Removing special_menu_item does not change anything - it just overrides and run menu functons that would have run anyway.
How memcache would improve performances? It seems to do the same thing than apc - would it be a replacement (all I read about is that it does not do better tan apc), or does it has additionnal features and would run together with APC?

apc sats here see.asso.fr/apc

Images

davidmac's picture

See the comment above on images, as they represent a significant portion of bandwith.

Then still, I would cache the

Martijn Houtman's picture

Then still, I would cache the menu blocks, even for authenticated users. According to the XHProf you showed, it would save about 400ms of menu link generation.

I have seen some serious improvements when running memcached instead of APC, especially since I am running FCGI. It basically does the same for object caching, yet it is done centrally, so when using multiple application nodes, it's a must.

400 Modules with APC Cache

Peter Bowey's picture

If you assume (reasonably) that each Drupal module loaded / accessed (on a page request) requires ~8Kb of memory (and cache space); the APC Cache total would need be 8Kb * 400 = 3,276,800 bytes.

So ideally, to minimize the impact of pulling raw disk data for 400 modules at the I/O disk level, the APC PHP cache would need to be increased to 3276800 bytes = 3.125 Gb. With likely APC fragmentation resulting, that should be more than doubled!

A reasonable conclusion, increase System memory and caches, or start pruning / optimizing 400 modules. An average Drupal module will typically add about 10 function calls to every GET (page) request.

If you are happy with the current anonymous I/O times, but looking for a sharper edge for 'logged in' users; then consider the use of Nginx's micro-caching. See: http://drupal.org/node/1408410

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

Peter, you have your metrics

Martijn Houtman's picture

Peter, you have your metrics wrong, it should be 3.125MiB :-)

Edit: MB, not MiB.

Thanks Martijn

Peter Bowey's picture

Oh dear, late night! Many thanks Martijn for pointing out my numerical error. Only 10 minutes after I entered that data, my brain said 'wrong' - you missed 1 section with / 1024... I will sleep / hide until the new day ;-)

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

In my testing using APC for

wipeout_dude's picture

In my testing using APC for anything other than Opcode caching was problematic and ended up using a lot of memory and fragmenting the cache almost instantly.. If you are running apache with fcgid there are also a number of issues with the effectiveness of APC caching.. If you are using apache with mod_php then you are probably using a lot of memory..

In general any caching is only effective if the content doesn't change often and the page is being requested regularly.. For example if you have a page that is accessed once every 10 min and your caching is set to 5 min the cache will not help at all and will probably slow things down.. If that same page is accessed every 30s then caching will be far more effective.. Same goes for microcaching, only really beneficial on pages being hit multiple times within the cache expiry period so if you have a 1s microcache expiry then you really need the page to be being hit more than once per second..

On my server I did see a definite performance improvement by switching from Apache to Nginx and running PHP-FPM.. Also recently switched to PHP 5.4 which dropped memory usage and APC cache required for the site..

Might be worth looking at your disk IO as well.. Perhaps running Drupal from an SSD (if you aren't already) would have some benefit or once your code is stable set apc.stat=0 so the php files are not checked by APC for changes once they are cached.. Means you have to restart PHP when you have code changes..

Obviously all these things are treating the symptom not the cause.. The place to start is most definitely with reducing the number of modules..

Thanks, I already have many

jvieille's picture

Thanks, I already have many things to look at...

  • I am running mod_php, not fcgi - is that good?
  • APC has 1G, but never asks for more than 300M
  • e-Commerce on a separate install would negate most of the benefits of the current design. Any product sold is related to content relevant in the main site, grants access to roles, OG groups, add users important runtime information....
  • how can I cache blocks? I already set the "cache_block" and "cache_menu" table in cacherouter (mysql tables are empty), the performance page does not allow the set block cache because of access control modules, but boost shoudl take care of everything.
  • I just cached panels: only one option is available "simple cache" that I set for 30 minutes, argument granularity (because they load differently for each of the 100+ groups)

My APC test show the same

Martijn Houtman's picture

My APC test show the same results as wipeout_dude. Fragmentation was huge after a few hours with object caching. Memcached works much better in my case. APC stat helped me on some sites (VPS with network storage mostly), on some other installs it had little to no effect.

@Jvieille

  • mod_php is fine for APC, but it has some memory drawbacks: it loads PHP for every call, even when plain images (non-PHP files) are being served. And some other drawbacks, for some other time :-)

  • If there are modules that disallow block caching, no block will be cached, it's hard-coded in blocks module. It's a big drawback in D7-, I think they're looking into this for D8 (manual override or so).

APC and Varnish

davidmac's picture

I have found significant improvements for large sites through the combination of APC and Varnish, https://www.varnish-cache.org/about.

Have you considered Varnish?

How does Varnish handle

Martijn Houtman's picture

How does Varnish handle authenticated user requests? Is ESI a viable option yet?

ESI is viable

FluxSauce's picture

Check out the ESI project - http://drupal.org/project/esi - it plays nicely with Varnish (among other servers) and supports blocks, panel panes, context

Out of the box, the Varnish specific project - http://drupal.org/project/varnish - is intended for anonymous users.

For authenticated users, check out http://drupal.org/project/authcache

High level though, start by whittling down that module list.

Pressflow!

Jamie Holly's picture

Including things other people have said, I would also switch to Pressflow,which is a high performance distribution of Drupal. It contains several core patches to improve performance. One that would greatly benefit you is the drupal_lookup_path cache. Drupal does not cache path lookups, but Pressflow does and will give you a significant decrease in the number of queries.

Other suggestions:

As others have mentioned, you got some large images that should be resized. If you're using mod_php (most likely), then serving this static content will eat up a lot of memory as PHP is still loaded by Apache when serving it.

There are a few ways to handle anonymous pages. The easiest for you is using APC. As others have mentioned, APC can become fragmented with large object caches, but Cacherouter does allow you to mix and match caching methods. Use APC for the page cache and cacherouter for everything else, but always keep your cache_form in the database!

A better solution would be to use Boost for anonymous pages. That way PHP doesn't have any processing to do, so long as a page is cached.

The best solution is to setup Varnish on the server and let that handle cached pages. Varnish also takes have some some pretty significant server load when dealing with static content.

On the database.

You have an awful lot of queries there. The time is good, but you might be having query cache mess with you some too. If you have a development copy of the site, disable MySQL's query cache and enable query output in the devel module and check the queries again. You might have some in there that really take a lot longer to generate and could use optimizing.

400 modules???

This really is a killer. I would re-evaluate these with surgical precision. Many times people use bigger modules but only use one small part of it. If you find this in your scenario, then I would move the functionality you need to a custom module and cut a bunch of the fat. I took over a site from a larger Drupal shop a couple of years ago that had over 160 modules and real slow loading times. I did this very thing and reduced them down to less than 100 with no loss in functionality and a performance increase more then 5 fold.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

Try a CDN

technicalknockout's picture

It'll serve the static images fast and keep your server from processing those requests. I would also suggest reducing the number of modules. Keep an eye on the site building also, reducing content types and fields, if possible, might help. What I've run into sometimes is the modules iterate over all the instances of these ... sometimes adding a lot of unnecessary processing just to implement drupal hooks. As others mentioned, I would recommend reducing the number of modules as a general rule of thumb - in some scenarios I've found it worthwhile even to trade out some functionality for performance, but that is not a common case.

Is that the CSS Embedded

brianmercer's picture

Is that the CSS Embedded Images module doing all those 200kb+ css files? That's working horribly. Every new page seems to have a new advagg css bundle and each has 200kb+ of inline images in it.

So rather than caching the images once, they're being downloaded over and over. And they're taking 2-10 seconds per page. And some of them are admin images that your users will never see like the Farbtastic color wheel. See https://www.see.asso.fr/sites/see.shareontheweb.com/files/advagg_css/css...

Check out item number 16 on
http://www.webpagetest.org/result/130109_AM_PKS/1/details/
It's 232.8 KB and takes 5.25seconds to load. And since it's css and not jpg/gif it's blocking the rendering of the page.

On the front page it's item 21:
http://www.webpagetest.org/result/130109_7X_PN6/1/details/
and it's a 234.1 KB advagg bundle with the exact same images embedded.

You might try disabling advagg and css_emimage and using stock drupal aggregation until you can get all that sorted out.

"Time to first byte" of 1.5 seconds might not be great, but the reason you're waiting 5-10 seconds to "start render" is all the front end stuff: css and js.

Good catch: i disabled css

jvieille's picture

Good catch: i disabled css embedded images and advagg, enabled ie css optimizer and full optimisation, drupal core caching...
Yslow is still happy
This cut the first view by half... Just compare
before
http://www.webpagetest.org/result/130109_SS_78V/
after
http://www.webpagetest.org/result/130110_7X_7ZV/

APC seems much happier, with much lower miss rate.
The main blocker now is the download time of css, js and images. as MJD mentiioned it above.
What could make download so slow?
Would a cdn improve all that, saving Apache to serve them or only images?
Would Varnish instead of Boost manage that better?

Note 1: This post is amazing. A super concentrated expertise in tuning Drupal for high end sites...
Note 2 : 400 modules might look foolish, but Drupal bears it...

A different approach: put the

pmichelazzo's picture

A different approach: put the static files (css, js, images) in another server running lighthttpd (http://www.lighttpd.net/). With it, you can reduce the answer time, the number of requests and, of course, the size of the files (if you check the CSS, you can reduce a lot just changing the path of the images).

I know, it's hard to do it because involve new server, new setup, etc etc etc but if you REALLY need, can be a good way to reduce time.

Before that, you can reduce the size of the HTML generated removing comments, spaces and everything that you don't need.

2 cents more: looking the webpagetest results, you're spending 174ms just to redirect the see.asso.fr to www.see.asso.fr. Try to check using the right URL (www....)

All the best

Paulino Michelazzo
http://www.michelazzo.com.br

Yes, I'm Brazilian and we don't speak Spanish here (but I can speak too).

A lot of good advice

perusio's picture

has been given already. My $.02.

  1. If the static assets are the main issue use another domain just to host
    the images.

  2. Use nginx as a reverse proxy (eventually caching the images).

  3. Reduce the number of modules to make the bootstrap more light.

  4. Repeat and rinse 1, 2 for CSS and JS files if need be.

https is used on every page

MJD's picture

It probably only needs to be used on cart pages

so thats an easy win - cart* https everything else http

your changes thus far have improved the css, js & image download times

https does not seem to count

jvieille's picture

https does not seem to count for much here.

How could static assets be redirected somewhere else???
Varnish seems easy to setup, would it handle this?
Or CDN (alternative to Varnish, or something else?)

Using the CDN module, you'll

Martijn Houtman's picture

Using the CDN module, you'll be able to use a separate domain for static files, such as .js and .css, even images and other media. This has the advantage that your browser can open more connections simultaneously (because it's a setting per hostname), resulting in more content being downloaded at once (i.e. shorter 'waterfall' in the speed tests).

I've also done some improvements on my site by offloading some javascript from the header file to the footer (drupal_add_js has a 'scrope' option). This has the nice effect of page rendering being called earlier. The full load will not necessarily be shorter, but it will 'feel' faster.

https

MJD's picture

losing 302 redirects for people entering the site with http & the ssl negotiation add up to around 0.7 to 0.8 of a second and depending on how you have set up https on your system you probably only need to type in "cart*" and tick the right check box... to fix - how easy can it get!

Thats the same length of time as your biggest css file...

You will then be able to see the true download speed and see if it's worth doing anything else....

Definitely looking better.

brianmercer's picture

Definitely looking better. I'm getting Boost pages here in New York, so the html is coming pretty quickly.

Good advice in here.

You could investigate why the two theme css, grid16-fluid.css and local.css, aren't being aggregated and fix it to save two requests, but they'll be cached, so that's a bit nitpicky.

As Martijn says, you could lighten your < HEAD > and initial render by moving the js. Either changing the scope of individual files or you can try the quick and easy way of moving the $scripts variable down to just before the $closure variable in page.tpl.php. This may screw up some javascript, but often it does not. The modern way is to use a script loader like http://drupal.org/project/labjs to load the scripts asynchronously. That can also mess with your javascript. The addtoany script is already loading asynchronously, so that's not a problem.

As a heavy nginx user, I'll add a +1 to putting the css, js, and images on alternate domains/subdomains using CDN and serve those from nginx. It will also save your server memory over using apache2.2+mod_php and make your server run better in general. However, installing and configuring nginx is not as easy as enabling a module.

Or you can put nginx in front of the whole thing and then you'd get the benefit of serving boost static files from nginx as well, and probably faster ssl negotiation, but that will take more config work than just doing the static files.

Last thing

MJD's picture

As per my first post ...

those bitcache images take 5 times longer "Time to first byte" than standard images... so unless there is some big reason for using it I'd switch back to normal images...

I know the answer

PlayfulWolf's picture

If I am reading correct - you are using APC as user cache????????????

  1. STOP DOING THIS RIGHT NOW!!!! Because now it looks like APC is swapping disk.

  2. Use APC only for what it is designed for: opcode cache, that means do with drupal apc related modules exactly nothing. Just look at phpinfo() to check if it is running and has in your case 128-1024M size

  3. If your traffic is anonymous - Boost is the way to go. If it is mainly registered, then check views and block caching.

  4. Entity cache module should be enabled in any case.

I cannot say more, because it very much depends on the configuration of the site, so the steps I have described are more or less safe on any site.

drupal+me: jeweler portfolio

I, I use apc cache for user

jvieille's picture

I, I use apc cache for user cache, which seems to have a positive impact on performances.
Cacherouter enables the user cacce for some cache tables, I added some more.
Why is that wrong?

You can see apc running here http://www.see.asso.fr/apc
Boost is enabled and seems to work great for anonymous.

I tried Views caching, but is really annoying, frustrating. I use "Views cache content", the only module I found, but it really never update anything before the expired time, the settings are confusing... Better solution?

What else to cache (block cache is grayed of course because of permissions), how?
(running D6/Pressflow)

Thanks.

Well, for one thing, it's

Martijn Houtman's picture

Well, for one thing, it's extremely fragmented, making it dog slow. In my experience, APC is only useful for opcode caching. I use memcache for user caching, it usually makes a big difference (about 15-20% in page speed).

Why is Views caching annoying? It's a hell of a lot faster. Is the content that dynamic?

Exactly! Just switch it OFF

PlayfulWolf's picture

Exactly! Just switch it OFF for user cache. Period. Second - all of the views, which are not changing for some period of time - cache them, there is option in views config page

drupal+me: jeweler portfolio

A Lot Depends On The Site

Jamie Holly's picture

See http://www.memonic.com/user/2ni/id/1cefk for an explanation of APC fragmentation and how to fix it.

Are you using APC for cache_form? If so, then switch it to using the database. There's a couple of reasons for this. First, that cache can get huge and eat up a lot of memory. Second (and most important), if the cache is cleared while a user is filling out a form, then they will get a validation error when submitting the form.

A lot of times you can evaluate your site and end up going with native database caching. It depends on how hard your database is working. If you got some performance to spare, then database caching is faster than APC or memcache. Remember, MySQL also has a cache in it, the query cache, so tuning that and MySQL over all and just using that for cache can, a lot of times, make the site even faster. A lot depends on how write intensive your site is and how often cached objects have to be regenerated.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

Ah, yes, good point:

Martijn Houtman's picture

Ah, yes, good point: cache_form should always be on persistent cache, so you'll have to exclude it from both APC and Memcache.

If you got some performance

dalin's picture

If you got some performance to spare, then database caching is faster than APC or memcache.

Wow, that's a pretty bold and controversial claim. I don't think I can believe that without seeing some data to back it up.

--


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

Someone actually did do the

Jamie Holly's picture

Someone actually did do the benchmarks on that a few years back. I was thinking it was Khalid, but I can't find it on 2bits.com. I tested it myself not long after and saw the same thing. True APC has matured a lot more since then, so APC might be faster now, but I doubt Memcache is.

When I get time I'll set up some tests to see where it is at now. It would be interesting to see too how it performs using MySQL's memory/heap storage engine for cache.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

APC fragmentation is bad

kbahey's picture

APC fragmentation is bad and hurts your performance. Whether it is due to allocating too little for the op-code cache, or using it as a data cache and there is a lot of cache inserts and deletes. The end result is the same: poor performance.

Here is the article you saw. The graph at the bottom is telling.

High PHP execution times for Drupal, and tuning APC for include_once performance

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Quick and dirty test between

Jamie Holly's picture

Quick and dirty test between database caching and APC. I didn't do Memcache because Memcache is slower than APC (you've got the overhead of a socket connection in there).

APC

Concurrency Level:      10
Time taken for tests:   9.787 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      2767300 bytes
HTML transferred:       2725900 bytes
Requests per second:    10.22 [#/sec] (mean)
Time per request:       978.716 [ms] (mean)
Time per request:       97.872 [ms] (mean, across all concurrent requests)
Transfer rate:          276.12 [Kbytes/sec] received

Database

Concurrency Level:      10
Time taken for tests:   9.941 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      2767300 bytes
HTML transferred:       2725900 bytes
Requests per second:    10.06 [#/sec] (mean)
Time per request:       994.105 [ms] (mean)
Time per request:       99.410 [ms] (mean, across all concurrent requests)
Transfer rate:          271.85 [Kbytes/sec] received

That's off PHP 5.3.22 and APC 3.1.9 and MySQL 5.1.97. These are on a straight D7 install with 500 nodes and a max of 75 comments each. The difference is minimal. Given the performance improvements in MySQL 5.6, I wouldn't be shocked to see MySQL take the lead again.

Again - this was a very quick and dirty test while I wait for a new hard drive to get here!


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

Oh right, I remember Khalid's

dalin's picture

Oh right, I remember Khalid's blog post now. A few points though:

  • MySQL could only ever outperform APC/Memcache when running on the same server as PHP. If your DB is on a separate server you will be hard-pressed to see the same result.

  • A quick benchmark with AB is one thing, but in the real world we have constant actions which would cause the query cache to be invalidated. In these cases I would think the stability of a dedicated cache backend is more desirable than any slight gain in an idealized setting.

You're right though, it would be interesting to see some tests using some lessor used techniques like a heap table, or using the memcache API to access data in MySQL (5.6).

Also note that MySQL 5.6 may actually be slower than 5.5:
http://www.mysqlperformanceblog.com/2013/02/18/is-mysql-5-6-slower-than-...

--


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

Yeah I would never use MySQL

Jamie Holly's picture

Yeah I would never use MySQL caching on a dedicated MySQL server.

This does bring into light though the need to identify which caches change a lot and which don't. On the more static caches (ie: filter if you don't have a lot of content changes frequently) might be better to keep in MySQL. For example, I have one client that uses APC, Memcache and MySQL. MySQL stores form and filter. APC stores everything else, but one custom cache for their media. That's in MemCache because another server has to access that data as well. It's worked out very well, but again it totally depends upon the site and exactly what you are doing.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

MySQL 5.6 is slower - see

Caching to the database vs. memcache

kbahey's picture

Regarding caching in the database compared to memache.

Here is something that confirms it could work well in certain cases. The site has to be mainly for anonymous users. Memcache and MySQL are on the same web server. The site is medium traffic.

We had a client who hired a rather "interesting" developer, who had no idea how to do things, yet in his mind, he was gung ho about it, and ridiculed every other piece of information given to him.

Among various blunders, he moved the site's directory from one place to the other, and started over with a default settings.php file. This disabled memcache which was in the original file.

The site kept chugging along without issues, apart from a spike observed in Munin's MySQL statistics.

This site gets some 150,000 page views per day, with spikes of 250,000 regularly, and the odd one every month or so of 400,000 to 600,000.

We observed that and fixed things before a major event was due, so can't tell if it had survived this.

Having said that, I enabled memcache for any site we can do so. It is a no-brainer, and really helps.

P.S. Other blunders of this "creative" developer were wiping the entire git history for the site, because he imported the site in a fresh new repository, and adding modules that had cookies thus disabling Pressflow's page caching!

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Well, I have another factor

Martijn Houtman's picture

Well, I have another factor to add into the mix: the type of webserver <-> PHP interface.

I run a few servers that use Apache with FCGI (not FastCGI). So a few CGI processes are started and used by multiple requests. APC cache is NOT shared between processes in this case, meaning there are several cache instances running at the same time, and they can all (possibly) be caching different things, leading to odd results, especially if a user is not bound to a specific process. I've noticed this when refreshing apc.php a few times, and noticed the results differed a lot a few times.

Now I am using PHP-FPM, which does share the cache, and I think mod_php also does (but has its own drawbacks).

Just my two cents :)

I am the original poster of

jvieille's picture

I am the original poster of this thread about running a complex Drupal site.
After more than 3 years, the site is now mature and is acceptably performant: most pages are served to anonymous users in about 1-2 seconds. It is still acceptable for logged-in users.

Since that time:
- some modules dropped, new added - currently about 250
- Update of File Framework that significantly improved speed
- Boost modified for caching of FF/Bitcache image objects (most images are served by Drupal and weren't cached - there are many in some pages)
- APC without CacheRouter, no user-cache
- Memcache configured as recommended
- Mysql query cache disabled
- Comfortable server 8*3GHz 64GB
- advagg, Labjs but not sure this impacts performance significantly