We hope you enjoy reading this blog post
If you need help with website or marketing, book a call with our team for a free 360° overview and actionable recommendations report. Book a call
If you need help with website or marketing, book a call with our team for a free 360° overview and actionable recommendations report. Book a call
Today I will be talking about APC (Alternate PHP Cache) and how to install it on Ubuntu servers to speed up Drupal. So lets get right to it.
Before we begin I think it’s a good idea to set a performance benchmark to gain a better sense of the effect APC will have on site performance. One way to do this is use the Apache Benchmark (ab) tool (substituting your own website of course):
ab -n 10 -c 10 http://www.somewhere.com/
This will hit the server with 10 requests with a maximum of 5 requests running concurrently. Repeat the test a couple times then average out your results to get a sense of where your performance stands before we install APC. These were my results:
First we have to install PECL and the latest PHP-dev packages. You might already have these packages installed, but it doesn’t hurt to run them again to make sure.
sudo aptitude install php-pear
sudo aptitude install php5-dev
sudo aptitude install apache2-dev
*Please note there are some excremental modules that are part of APC. Do not enable them including debugging feature. Simply type [no] for each module.
sudo pecl install apc
To enable in APC all we need to do is edit the php.ini configuration file:
sudo nano /etc/php5/apache2/php.ini
# Add this to the bottom of the file:
extension=apc.so
apc.enabled = 1
apc.shm_size = 48
Once we restart Apache, APC will be enabled with a memory limit of 48MB. This should be enough for most Drupal installs, but if you have a lot of Drupal modules enabled you may want to come back and increase this number later. If there is not enough memory in the APC cache you may end up hurting your performance instead of enhancing it. Restart Apache to finish the installation:
sudo service apache2 restart
And that’s it! APC is now installed and running.
Lets try to run our test again to see how APC is performing:
Please complete the form below and one of our team members will be in touch shortly.