Archive for June, 2013

In part one, we have grasped the idea of inter relationships between performance and scalability and further explore the role of PHP to fine-tune these parameter through opcode cache. Basically, opcode cache sits in between the PHP and server machine. Since PHP recompiles code upon each request and this takes time and resources. Therefore, opcode cache remembers the first compiled version and serve that in future request without reinventing wheel again.

Apart from this, there are various opcode caches available in the market. Fortunately, Zend server has one that is in-built whilst Microsoft is providing WinCache on proprietary platform. In opensource, area has APC as a big name. However, the installation of these products during PHP MySQL programming are easy and straightforward process. By using these products, you can gain instant and considerable performance improvements hence scalability.

It is well verse that PHP is dynamic language and generating dynamic pages that any user can change at any moment. It is general perception that dynamic pages constantly or frequently changing, but in reality, most of the dynamic pages hardly exhibit any change once they are generated. For instance FAQ page or a press release which are not changing, but in background PHP is working and CPU cycles are consuming resources to keep its process.

If we PHP MySQL developers really wish to save some we need to remove the dynamic nature of such pages so we can stop the background processes and unwanted client server interactions thus lots of CPU processes. There are several ways out to do these tasks and one of them is pre-generate HTML pages from the PHP and have to serve those pages directly to the users. Here we will experience a drawback if some changes happen to those pages it will reflect on delayed schedules, not in real-time.

Another way is to approach this problem is to implement on-the-fly cache. In this sort of PHP MySQL development entire script output is captured in to the buffer in form of file system or in to the memory in form of cache or in the database like MySQL. Whenever future requests occur that script will read from the cached copy and prevent the entire dynamic reading and delivery process saving time and processing power hence lots improvement in performance and scaling. With jpcache you can manage such processes while with Smarty templates you can get done automatically.

Conclusion :-

When performance and scaling of application are concern PHP is offering some distinctive advantages being a dynamic language of modern era. We have several mechanisms to combat with this problem and opcode cache is one of them. Same the way we can improve performance by removing the dynamic nature of nearly static pages generated by PHP.