When you host a good number of virtual sites on your VPS it’s not a good idea to use the default settings of PHP APC because unless you have a large amount of ram to spare, then chances are APC will gobble all of it. And when PHP APC runs out of memory to use, it could lead to other problems like load spikes and cache slams.

Here’s the quick hack I did to enable PHP APC on only one virtual site.

nano /etc/php.d/apc.ini

Inside the ini file locate the apc.filter variable and set it to the following:

apc.filter = ".*,+/home/user/public_html/.*"

Save apc.ini and restart php-fpm

service php-fpm restart

What the setting did was it enabled the filter which skips all php files (.*) that apc is supposed to cache. Then by defining (+/home/user/public_html/.*) apc will cache all php files under the directory.

By doing it this way you can enable PHP APC to a select sites that you need cached. As far as my experience goes, each WordPress site uses about ~20 MB of APC cache memory (will likely vary depending on your WordPress site, plugins installed etc.) so if you use the default apc.shm_size which is 32 MB, you can safely cache at least one WordPress site.

The reason I don’t recommend going for two sites based on the figures above is because you need to have a good amount of spare cache memory to prevent fragmentation. I usually go for 10% to 20% of free memory, the more, the better.

Some things you should know.

web-server: nginx 1.2.7
php: php-fpm 5.4.7
apc: php apc 3.1.13
db: mysql 5.5.28

 

{ 0 comments }

For a guy like me who has more than a hundred (and growing) different user names and passwords to remember it can be a frustrating experience whenever I forget a user/password pair. Fortunately, I don’t have to do that anymore though after I discovered the DropBox and Efficient Password Manager (EPM) combo. While a lot of […]

{ 4 comments }

Read More

Here’s how I installed nginx + php-fpm + apc + mysql on CentOS 6.2 x64. This will likely work on version 6.3 as well. A big thanks to Remi from famillecollet.com for his stable binaries (repositories) on CentOS and Mell Zamora for creating a kick-ass CentOS guide where I based my installation. Please note that in all […]

{ 1 comment }

Read More

It all started with with curiosity and a free trial. For one, a $5 per month virtual private server with virtually unlimited bandwidth sounds too good to be true. As far as I know this would be the first from DigitalOcean. However, I was taken by surprise not only with the lower cost but specially […]

{ 5 comments }

Read More

I had the good opportunity of ending up on Jim Westgren’s article about using Redis as a front end cache and it didn’t take long for me to try it on one of my virtual boxes. The results were unbelievable, pages that were taking about 0.2 to 1.2 seconds were now loading at 0.0025 second […]

{ 71 comments }

Read More

I just said goodbye to my old windows mobile phone yesterday. Got myself an LG P500 (with a stock Android Froyo) since it came bundled with my mobile line (Globe). I have to say that this mobile OS is definitely for geeks. Since Android Gingerbread was already out, I decided to upgrade my phone’s OS. […]

{ 8 comments }

Read More

I converted one of my websites today with static html pages to WordPress. Problem is I don’t want to lose the URLs on that site since they were already good as is. Solution, install WordPress on a different directory first – www.domain.com/wp/ then after the content has been transferred/copied, route it to www.domain.com. 1. I […]

{ 1 comment }

Read More

I’ve set my laptop to sleep after half an hour but sometimes I need to leave immediately and I want to sleep it right away, however for the nth time I’ve accidentally shutdown my computer instead of putting it to sleep. Solution (which I’ve been putting off for a long time)? Change the default action […]

{ 0 comments }

Read More

For you folks who are having a hard time looking for a guide to get your Windows Mobile Device connected to your Windows 7 64bit OS. Here’s how to go about it: 1. Download this driver update: Windows Mobile Device Driver for Windows 7 64bit 2. After downloading the device, install it. Should you get […]

{ 0 comments }

Read More

I just find the default behavior of Windows 7 explorer to be annoying. The left navigation pane doesn’t automatically expand to the current folder. If you wish to change this behavior to expand the directory tree when a folder is selected, do the following: 1. Open windows explorer.2. Press alt + F (do not release […]

{ 2 comments }

Read More