CopyPastehas never been so tasty!

8 Rocking Tips for Scaling PHP to 25000 Concurrent Users Per

by anonymous

  • 0
  • 0
  • 0

php application developmentScalability is the ability of a system, network or process to get enlarged or handle huge amounts of work in an effective manner. Web platforms or languages like PHP become scalable when it manages growing traffic with additional resources and without any software changes.

With the growing preference for PHP as the language used in web development, it would be rather necessary to look into few tips on scaling PHP to allow it serve large numbers of concurrent users per server. Things as these below would exponentially increase confidence in php development.

1. Clustering the Web Servers
The very first step towards scaling PHP needs to be taken in the form of moving the database to a separate server, configuration syncing (rysync, rmp/deb, svn), deploying application code and ZSCM.

2. Using the APC Feature of PHP
Enabling the APC feature is an essential way of boosting the performance of any particular website. This feature, therefore, plays an important role in scaling PHP as well as enabling it serve huge number of users.

3. Placing Things which are not PHP Requests on a CDN
Gone are the days when one would be required to get stuck at the origin server with static file requests. Serving the static files from the web server is no longer a necessity. Instead, everything is put on S3 while CloudFront is used as the CDN. However, the recent problems in CloudFront often make it a more feasible option to serve directly from S3.

4. Avoiding Connection to Other Servers in the PHP Code
Other servers such as the database or memcache servers should not be connected to unless it is either a dire necessity or there is no other way. A clear majority of the PHP web apps use the MySQL database for managing the backend session and the memcache tool for caching. During the flow of the execution, connecting to other servers lowers the efficiency quotient. For instance, it blocks and runs up the CPU apart from holding up the line often. It is here that using the APC is more recommended for storing data in PHP.

5. Using Varnish
Varnish is actually the Memcache/ModRewrite of web server caching. A majority of the pages on the website do not change. Putting Varnish on the web server makes a huge difference to the web app and this is quite visible right at the time of load testing.

6. Using a c1.xlarge
Upgrading to a c1.xlarge version is a welcome option as the m1.medium has a single CPU to handle all the requests. The c1.xlarge version had 8 CPU’s and even during the app test, one would get an apt-get install nmon, run nmon and at the same time, monitor the CPU. The server actually uses all the 8 cores to churn out the pages.

7. Using the Right Techniques
Whenever it comes to scaling PHP, the appropriate techniques must be implemented for the best results. These techniques include replication, functional separation as well as sharding. Other ways in which the scaling can be done effectively encompass using of schemaless databases such as MongoDB. Considering a column-oriented database like Infobright is more preferred for the analytics.

8. Optimizing Applications with the Desired Tools
Application optimization is intricately linked to the scaling of PHP and selecting the right tools is necessary for this. The tools that are generally used are Xdebug, Zend Server Code tracing and Profiling. Other efficient ways of optimization are monitoring the execution time, memory usage, designing intelligently and being aware of the respective hardware and its operation. The higher the knowledge, the better is the app created.

Once the scaling is carried out using the above- mentioned tips and techniques, the effectiveness of the app can be judged. Google Analytics helps in showing the numbers of seconds an average user spends on an average page.

We provide php application development services. If you would like to discuss with an certified php developer from our team, please get in touch with us at Mindfire Solutions.

Add A Comment: