Boosted LAMP for Drupal devs

Submitted by vadim on Wed, 07/11/2012 - 16:05

In one on my previous posts I wrote how to configure Drupal development environment in Ubuntu, in this post I am going to talk about performance on your localhost (PAE, APC and MySQL tuning). There is also another blog post about Tuning Drupal Performance for production which is a bit different thing.

My old laptop was broken last days so I quickly found a cheap replacement, which had a bit different insides: two AMD cores VS four Intell i3 cores and 4GB vs 3GB. I decided to try Linux Mint, which is said is better then Ubuntu. IMO for LAMP stack the name of the Linux distribution is not so important, because they are all working good now :) But you should decide which version of one to chose: 32 bit or 64 bit. In this post I found out that 64 bit Linux is better for development, but it could be not good enough for some applications, which could fail running on 64 bit Linux.

Memory utilization for 32 bit Linux

I decided to chose 32 bit version of Mint. But the first thing I noticed was 2.6GB of RAM was only available. That looked very weird and that was one of disadvantage of 32 bit system. When I was running full LAMP stack + IDE + Skype I saw almost almost all memory was used and some disk space were taken for swap. Fortunately good people wrote Physical Address Extension (PAE) which could be installed with the following command:

$ sudo apt-get install linux-generic-pae linux-headers-generic-pae

That worked good and then System Monitor showed 3.5 GB of RAM. Still not 4, but it could be a unit conversion issue. I am glad that swap is not being used and system is working faster now.

Configuring Alternative PHP Cache

A bit later I cloned a big project and I saw how hardly my machine was trying to handle requests, which used to slow down the system. So the way out was to install APC. Alternative PHP Cache is a free, open source framework that optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in shared memory. In Mint or Ubuntu it could be installed with following command:

$ sudo apt-get install php-apc

Then I made sure that /etc/php5/conf.d/apc.ini file is in place and overrode default settings:

extension=apc.so
apc.shm_size=128M
apc.max_file_size=10M

Then I installed APC module for Drupal that allows to store Drupal cache in memory instead of database. That should give me huge performance increase. I made sure that the size of project cache tables was less then shm_size in config file, enabled APC module and added following lines into settings.php file:

$conf['cache_backends'] = array('sites/all/modules/apc/drupal_apc_cache.inc');
$conf['cache_default_class'] = 'DrupalAPCCache';
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

See module's readme to check for more options.

MySQL tuning

Despite APC cache was enabled, it was not affecting on the database performance, so I needed to change settings of MySQL to make it work faster. Below are values which I overrode in MySQL configuration files.

/etc/mysql/mysql.cnf:

[mysqld]
key_buffer              = 128M
max_allowed_packet      = 128M
max_connections        = 300
table_cache             =  256
query_cache_limit       = 16M
query_cache_size        = 128M

/etc/mysql/conf.d/innodb.cnf:

[mysqld]
innodb_buffer_pool_size = 1024M
innodb_additional_mem_pool_size = 32M
#innodb_log_file_size = 16M
innodb_log_buffer_size = 4M
innodb_flush_log_at_trx_commit = 2
innodb_thread_concurrency = 4
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1

Check out what do those settings mean.

Conclusion

Finally I had up to 100% increase in performance. I have not tried to change my HD to SSD yet, but I am sure, it will gain even more performance. BTW, here is an interesting manual, they use it to perform automated tests. It does even allow to run MySQL in memory instead of disk. Enjoy!

If you are interested in performance increase for your production website you can check out my other post Tuning Drupal Performance.

918 comments

I always visit this site why

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 21:32.

I always visit this site why because it provide effective content and example which are important for me because I learn various things about life. reverse my disease today review

I would also motivate just

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 18:49.

I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance. I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance. how can i control my high blood pressure without medication

Recurve Bow Planet

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 20:21.

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.Recurve Bow Planet

AcademyOne Learning is the

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 17:37.

AcademyOne Learning is the North American branch of M-Bytes Pty Ltd, a family company founded by Mary and Bharat Sanghvi, Math teacher and computer programmer, respectively. About Academy One Learning

You should comment on the

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 17:10.

You should comment on the details of the blog. You can dispatch it's pure gold. Your blog hunches shall expand your subscriptions. hyperlink

First You got a great blog .I

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 16:33.

First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics , i will be always checking your blog thanks. i have diabetes and my feet are killing me

If you want to attract more

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 15:30.

If you want to attract more women and make them feel a strong desire to sleep with you rather than always seeing you as their next "best friend", then the Desire System is for you. voyance gratuite

Wonderful article this is.

Submitted by Anonymous (not verified) on Wed, 07/30/2014 - 13:30.

Wonderful article this is. Everything is almost in the perfect place with this article. I could not have asked for a much better article than this. Thanks for publishing this and I will be looking forward to your upcoming articles and I hope not to be disappointed. Cheers! what is cloud computing

thanks you

Submitted by Anonymous (not verified) on Thu, 07/31/2014 - 08:23.

thanks you very much for your share,, good job

Reverse Cell Phone Lookup

Submitted by Anonymous (not verified) on Wed, 07/30/2014 - 18:22.

This website has very good content. Please let me know if you're looking for a article author for your weblog. So I am sure this website will form the well-known in the future. Someone I work with visits your blog regularly and recommended it to me to read also.Reverse Cell Phone Lookup

awesome

Submitted by friendship day (not verified) on Wed, 07/30/2014 - 02:20.

love it Friendship day 2014

Very informative post! There

Submitted by Dellia (not verified) on Tue, 07/29/2014 - 00:19.

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign! https://archive.org/details/PregnancyMiracleBookLisaOlson

I would also motivate just

Submitted by Anonymous (not verified) on Mon, 07/28/2014 - 21:33.

I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance. how to make a girl obsessed with you

When I was running full LAMP

Submitted by mount sophia condo (not verified) on Mon, 07/28/2014 - 15:19.

When I was running full LAMP stack + IDE + Skype I saw almost almost all memory was used and some disk space were taken for swap.
mount sophia condo

Une équipe de voyants,

Submitted by Anonymous (not verified) on Mon, 07/28/2014 - 13:32.

Une équipe de voyants, choisis pour leur professionnalisme et leur aptitude à la lecture de l'avenir, sauront vous donner des indications qui vous permettront d'effacer vos doutes et vos angoisses.voyance gratuite

Pretty good post. I just

Submitted by Anonymous (not verified) on Sun, 07/27/2014 - 18:38.

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. voyance en direct

cheap elo boost

Submitted by Anonymous (not verified) on Sun, 07/27/2014 - 21:59.

This website has very good content. Please let me know if you're looking for a article author for your weblog. So I am sure this website will form the well-known in the future. Someone I work with visits your blog regularly and recommended it to me to read also.cheap elo boost

I made sure to bookmark your

Submitted by anymous (not verified) on Sun, 07/27/2014 - 00:28.

I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it. doc to html

I got here much interesting

Submitted by anymous (not verified) on Sat, 07/26/2014 - 14:10.

I got here much interesting stuff. The post is great! Thanks for sharing it! cheap brochure printing

Please let me know if you're

Submitted by best boots for women (not verified) on Sun, 07/27/2014 - 16:36.

Please let me know if you're looking for a article author for your weblog. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd love to write some material for your blog in exchange for a link back to mine. Please shoot me an email if interested.best boots for women

Easily, the article is

Submitted by Anonymous (not verified) on Sat, 07/26/2014 - 13:34.

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. https://www.rebelmouse.com/60secondpanicsolutionreviews/

Congratulation for the great

Submitted by anymous (not verified) on Sat, 07/26/2014 - 13:28.

Congratulation for the great post. Those who come to read your Information will find lots of helpful and informative tips. Article

Thank you for this post.

Submitted by Anonymous (not verified) on Sat, 07/26/2014 - 10:41.

Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners. www.rebelmouse.com/

Thank you! I am find

Submitted by best epilator for women (not verified) on Sun, 07/27/2014 - 16:38.

Thank you! I am find information on this topic as I am working on a business project. How did you get to be this great? Its remarkable to see someone put so much passion into a subject.best epilator for women

Easily, the article is

Submitted by Anonymous (not verified) on Fri, 07/25/2014 - 15:24.

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. https://www.rebelmouse.com/texttheromancebackmichaelfiore/

Awesom article and post ,

Submitted by Anonymous (not verified) on Fri, 07/25/2014 - 14:47.

Awesom article and post , obviously in your web page everything is outstanding.Thanks for useful and beneficial publish. https://www.rebelmouse.com/howtomakehimdesireyoureview/

This website has very good

Submitted by ninja blender reviews (not verified) on Sun, 07/27/2014 - 16:39.

This website has very good content. Please let me know if you're looking for a article author for your weblog. So I am sure this website will form the well-known in the future. Someone I work with visits your blog regularly and recommended it to me to read also. The writing style is great and the content is top-notch. Thanks for the insight you provide the readers!ninja blender reviews

The problem for many people

Submitted by Anonymous (not verified) on Fri, 07/25/2014 - 12:27.

The problem for many people is that they feel they have some insurmountable obstacles in their way that keeps them from getting started. yeast infection no more

Most of the time I don’t make

Submitted by Anonymous (not verified) on Fri, 07/25/2014 - 10:30.

Most of the time I don’t make comments on but I'd like to say that this article really forced me to do so. Really nice post! details

So, you've posted this

Submitted by Anonymous (not verified) on Fri, 07/25/2014 - 09:14.

So, you've posted this article today? Well, I am really impressed by this. It's got all the information I needed on this topic and the article itself looks very amazing. Brilliant job! Keep it up! boost your bust book

Big thumbs up for making such

Submitted by Belda (not verified) on Thu, 07/24/2014 - 13:14.

Big thumbs up for making such wonderful blog page! https://archive.org/details/TaoOfBadassReview

I would be glad to recommend

Submitted by anymous (not verified) on Thu, 07/24/2014 - 12:42.

I would be glad to recommend the post for its quality content. Nice post. garcinia cambogia

I just couldn't leave your

Submitted by Anonymous (not verified) on Thu, 07/24/2014 - 10:52.

I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts. gold IRA

Very informative post! There

Submitted by Anonymous (not verified) on Thu, 07/24/2014 - 10:41.

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign! The Venus Factor reviews

I will be interested in more

Submitted by Anonymous (not verified) on Thu, 07/24/2014 - 10:25.

I will be interested in more similar topics. i see you got really very useful topics , i will be always checking your blog thanks. get rid of dark circles

Your music is amazing. You

Submitted by Anonymous (not verified) on Thu, 07/24/2014 - 09:55.

Your music is amazing. You have very talented artists. I wish you the best of success. www.quadone.com

Thanks for taking the time to

Submitted by Anonymous (not verified) on Thu, 07/24/2014 - 09:48.

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. sildenafil online

Thanks for some other

Submitted by anymous (not verified) on Thu, 07/24/2014 - 00:06.

Thanks for some other informative blog. The place else may just I get that kind of information written in such a perfect methoddownload FIFA 14 Coin generator

Thanks for sharing this

Submitted by Anonymous (not verified) on Wed, 07/23/2014 - 20:44.

Thanks for sharing this interesting blog with us.My pleasure to being here on your blog..I wanna come beck here for new post from your site. truth about cellulite review

Very informative post! There

Submitted by Anonymous (not verified) on Wed, 07/23/2014 - 19:30.

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign! capture his heart and make him love you forever review

This article is really thce

Submitted by Anonymous (not verified) on Wed, 07/23/2014 - 18:33.

This article is really thce best. So, I would like you that you keep on continuing your work on this article. And upload as many new articles about this as possible. text your ex back book

clash-of-clans-hack

Submitted by prem (not verified) on Wed, 07/23/2014 - 19:30.

hello friends you can get free clash of clans game codes and hacks gems through this site....
http://freehacksandcodes.com/clash-of-clans-hack

Hey there thanks for showing

Submitted by Allen (not verified) on Fri, 07/25/2014 - 14:19.

Hey there thanks for showing me this. I must say that your blogpost was the most enjoying read I've seen in a long time. Greetings fromGenerate Bitcoins Online

I was also searching related

Submitted by Allen (not verified) on Fri, 07/25/2014 - 15:24.

I was also searching related stuff from long time.You have solved my problem.Thanks for sharing this great stuff with us High Pagerank Backlinks
buy high pagerank backlinks

I, along with my partner

Submitted by Anonymous (not verified) on Wed, 07/23/2014 - 17:37.

I, along with my partner here, were just wondering if you could tell us the source of the place where you get this all important information from. breakup doctor review

This is my first time at your

Submitted by Madday (not verified) on Wed, 07/23/2014 - 15:57.

This is my first time at your blog and I've really enjoyed looking around. I will come back again in the future to check out some of the other articles. facebook hacker

Binary Options Signals Review

Submitted by Binary Options Signals Review (not verified) on Wed, 07/23/2014 - 12:46.

I cannot thank you enough for the post.Really thank you! Will read on…
Binary Options Signals Review

This article is really the

Submitted by Anonymous (not verified) on Tue, 07/22/2014 - 19:57.

This article is really the best. So, I would like you that you keep on continuing your work on this article. And upload as many new articles about this as possible. only available online

This article is really the

Submitted by Anonymous (not verified) on Tue, 07/22/2014 - 19:01.

This article is really the best. So, I would like you that you keep on continuing your work on this article. And upload as many new articles about this as possible. how can i get a man to fall in love with me

This is such a great

Submitted by Anonymous (not verified) on Tue, 07/22/2014 - 17:57.

This is such a great information for me, because i do an online job thats why i need fast Internet connection, i search how to bost internet speed then ireach at a right place. https://www.rebelmouse.com/ultimateherpesprotocolreviews/