I'm installing Drupal 7 on a new server with 4 GB of memory. I'd like to get some hints on how to configure it properly, how much memory to give to MySQL, and how much memory to give to PHP. One thing I found out is that running Drupal 7 on Zend server is three times faster than running it on a normal Apache server. (I think it has to do with opcode caching. I noticed with devel module it uses one-third of the memory.

Can you share your configurations with me?


If you already have Drupal7 Data, you should load it into a staging environment and perform some buffer sizing based on the amount of data you have.

Step 1) You must first compute the buffer sizes for your dataset.

Step 2) If the recommended sizes exceed 75% of your installed RAM (in you case 3GB) then cap the needed buffers at 3GB.

Step 3) If you have InnoDB data and you did not enable innodb_file_per_table, you need to cleanup InnoDB by segmenting each table into its own physical tablespace (this only needs to be done once).

Once you have done this, you should plan to perform this configuration audit (Steps 1 and 2) every 6 months to make sure you have the proper MySQL caching in place.

Interestingly, I addressed a question similar to this and answered it on April 15th, 2011.


Some things to look at:

An article to read:

Rackspace's: Deploying Drupal in the cloud with nginx and boost should give you lots of ideas.

Small quote on opcode caching:

We use APC as an opcode cache. This saves the server from recompiling the PHP code on every page load. Moreover, the whole thing fits easily in RAM (we typically give APC 128MB of RAM). This drastically decreases the CPU usage. Logged in users can now browse the site much faster. But we can still only handle a limited number of them. We can do a bit better. Instead of querying MySQL every time we go to the cache, we can store these tables in memory. Here come memcached and the cacherouter module.


I started out with my_huge conf from the mysql directory; I also added Varnish cache to the mix. As you already found out, Zend improves performance lots.

After running for a few days, I ran the mysqltuner script and acted on some of the recommendations, mainly about the temp-table cache.


Depending on the size of the site you may want to look at memcached as well. This will compete for resources with mysql but can reduce the load on it.

  • Actually, you can scale down both the InnoDB Buffer Pool and MyISAM Key Cache if memcached is large enough. That way, memcached isn't competing with mysql, but mysql will simply complement memcached as a data conduit rather than as a main database. +1 for suggesting memcached first !!! – RolandoMySQLDBA Jul 21 '11 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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