My drupal site is taking too long wait time, and it uses CPU + memory. My server setting is

16GB RAM, 8 processors. So it is good.

I am using Commerce Kickstart distribution have enabled 180 modules all are required cant disable a single module, I cant use caching coz content is mostly dynamic. My site loads in 8 second (most pages) in which wait time is only 6-7 seconds. Multiple hits takes CPU usage to 100%. I have checked reports with xhprof, top command on server, database tuning script, front page executes 4,52,600 functions, PDO commit taking 31% CPU, Database connections are not properly closed.

I have tried database tuniing module, database tuning script but nothing is working fine right now for me.

Cant use caching even default drupal views caching.

Please suggest some steps, any help will be a big big favor. Website i am building is dynamic so caching is prohibited.

  • 2
    "Website i am building is dynamic so caching is prohibited." With the greatest respect, I don't think you properly understand what caching is. Dynamic websites have to use caching, because they are dynamic. If you refuse to use caching, you should definitely expect to have a slow site; Drupal is very database heavy
    – Clive
    Feb 6 '14 at 15:01
  • enabled 180 modules? That's some complicated setup. Maybe it's time to replace them with one optimised custom module?
    – Mołot
    Feb 6 '14 at 15:05
  • @Mołot 180 modules isn't that bad for a Drupal Commerce install. The latest one I'm building is currently at 203 (all 'required') and when we enable RMA and other features there will be more. It just makes caching all that more important
    – Clive
    Feb 6 '14 at 15:09
  • 1
    @Clive Oh, right, Commerce. My bad, missed it. Well, I couldn't agree more with caching in that case. Of course there are some in-RAM solutions with MySQL/Marina interface that can solve it, but they are not cheap, and not quite a drop-in replacements (yet?).
    – Mołot
    Feb 6 '14 at 15:16
  • "I have checked reports with xhprof" - What are the top 20 slowest calls?
    – mikeytown2
    Feb 6 '14 at 19:49

There are tons of performance options, I think with the beefy server resources you have we can tune it tremendously by doing the following:

  1. Database tuning
    • MySQL - make sure QueryCache is setup, and InnoDB is the only table type being used. You'll want to look at the high performance sample my.cnf (config) that ships with MySQL.
    • Memcache - configuring Memcache will speed up tons of the queries and sub-queries Drupal is notorious for.
    • Session Cache - for handling a lot of concurrent [unique] login sessions you can consider using a NoSQL database engine like CouchDB/MongoDB, it'll free up your MySQL db from managing those sessions.
  2. Web Serving tuning
    • OpCode Caching - speeds up PHP a lot, is basically a requirement on all Drupal servers nowadays. I use APC, and there are other solutions but APC will work reliably with very little setup; this one is a no brainer.
    • Caching - you seriously need to cache at least the home page for anonymous users, and when a user logs in their unique session will be handled correctly. Consider using Varnish (it'll allow your site to handle over 100x more anonymous traffic and there are tons of tips on how to use it with Drupal.

These are just the quick highlights of what you need to utilize. If someone says you can't use caching on your website then there is a flaw in either the product design or the system design. There are literally thousands of popular Drupal sites that manage tons of logins and anonymous traffic working just fine with this recipe.

  • Thanks for the reply i have tried memcache, APC, Varnish but issue with all these caching is i am not getting updated content. If content editor adds a content then it should come on desired page just after saving but its not the case when i am using caching please find attached image of xhprof output. When i see with top command on server it is giving me mysql taking too much CPU 99% of total use of CPU sometime during page load and CPU often touch 100%. i.stack.imgur.com/XrkDD.png
    – Tajinder
    Feb 13 '14 at 11:59
  • If MySQL resources are too high, then consider: 1. Moving MySQL to its own dedicated server/layer, if it's not already setup that way. May 11 '14 at 3:53
  • If caches are stale (old) after edit/update/adding content then you need to run a Purge subroutine. The "Purge" module for example will help. This is a common issue with edge caches, they need to update from the origin server. As for MySQL, consider: 1. Move MySQL to its own dedicated server/layer, if it's not already setup this way. 2. Triple-check your MySQL setup, comb over the my.cnf over and over; improper (low) allocation of resources (RAM, ports, caches) will degrade performance! I cannot stress this enough. May 11 '14 at 4:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.