Hey guys,
In this post we’re going to look at the Alternative PHP Cache plug-in and how you can use it boost the overall performance of your website. The Alternative PHP Cache is a free, open sourceframework that helps websites store the byte code of PHP files so that it can be utilized later to enhance performance. How does it do that? It’s quite simple. When the file is executed the first time around, the Alternative PHP Cache stores the byte code of that PHP file, and each time that same file is been used again, the Alternative PHP Cache provides the byte code of that file, saving the site from having to load it again and again. This cycle continues unless a change is made in the file, in which case the Alternative PHP Cache saves the updated byte code of the file and the process continues as before. As a result of this caching activity, the performance of the website can be enhanced up to 3X because you don’t need to compile and execute the same file each time.
If you don’t have the Alternative PHP Cache plug-in installed and a request comes to the server, the request is processed in the following manner.
On the other hand, if you have the Alternative PHP Cache plug-in installed, and a request comes to the server, the Alternative PHP Cache saves the byte code of that PHP file after the first execution and then keeps on providing that byte code for all further requests for that same file, as shown below.
Suppose you have a dynamic website developed in PHP. Every time there is a new request for a web page, your server first parses the file and then compiles and executes it. This sort of processing flow adds to the overhead on the server and really impact its performance, especially if you’re getting hundreds of thousands of web page requests (or hits).
In such cases, the Alternative PHP Cache offers the best solution as it’s designed to prevent exactly such a scenario. It’s really handy tool if you’re dealing with a dynamic website developed in PHP and are performance issues due to increased traffic.
Setting up the Alternative PHP Cache is also easy. The default settings work fine for most users but if you really performance conscious and have website that gets a lot of traffic, you can customize the default settings to ones more suitable to your needs. Here are the default settings.
apc.cache_by_default = On
apc.enable_cli = Off
apc.enabled = On
apc.file_update_protection = 2
apc.gc_ttl = 3600
apc.include_once_override = Off
apc.max_file_size = 1M
apc.num_files_hint = 1000
apc.optimization = Off
apc.report_autofilter = Off
apc.shm_segments = 1
apc.shm_size = 30
apc.slam_defense = 0
apc.stat = On
apc.ttl = 0
While customizing the settings you should keep two things in mind. The first being the cache size and the second being whether you want the Alternative PHP Cache to check the file on each request? These two things are controlled by the following files: apc.shm_size and apc.stat.
The default value for apc.shm_size is 32MB. 64MB is a more optimal setting but you can change its value based on the requirements of your web site.
The default value for apc.stat is “1”. This basically means that the Alternative PHP Cache will check the file on each request. But be careful while changing this setting, since if you do that, you’ll need to either restart the server or manually delete the cache, in order for the changes to take effect.
The Alternative PHP Cache is a very useful tool for boosting the performance of PHP based dynamic websites since it prevents the recompilation of the requested files with each data request, which greatly reduces the processing overhead on the server. And it’s highly customizable so you can change its default settings according to the requirements of your website.
As a leading mobile app development company (iPhone, Android, Windows Phone, HTML5 app development), Folio3 specializes in native app development services and cross platform mobile app development services for the iPhone and iPad. We also offer extensive mobile app testing and QA services. If you have a mobile app idea that you’d like to discuss please or would like to know more about our iPhone app development services, please Contact Us. Learn more about our iPhone, Android and Windows Phone app development services.
USA408 365 4638
1301 Shoreway Road, Suite 160,
Belmont, CA 94002
Whether you are a large enterprise looking to augment your teams with experts resources or an SME looking to scale your business or a startup looking to build something.
We are your digital growth partner.
Tel:
+1 408 365 4638
Support:
+1 (408) 512 1812
COMMENTS ()
Tweet