phpfox v3 performance optimization : Xcache or APC or Memcached or File Cache

Getting the best performance for website is always a challenge in the real time scenarios specially when you have hundreds of users on your website. As mentioned in our previous article, you loose potential users on website if your website doesn’t load with in few secs and very slow. We always try to get the maximum performance of the website by fine tuning the configurations of the hardware resources, application platform and business logic (database queries) in the application.

In this article, we shall discuss about the opcode and caching solution for the phpfox v3 platform and performance of these solutions on constant user load. We have used apache’s benchmark tool for this purpose and results were eye opener.

performance comparision xcahce apc memcache on phpfox v3

performance comparision xcahce apc memcache on phpfox v3

For this Benchmark, we tested 1000 request on the home page with 10 concurrent users. We have run the apache’s tool at least 2-3 times and pick the best case for the particular scenario. We shall not cover the installation of these caching solutions in the article, If someone is interested then please take a look at our previous blog. You can configure caching in phpfox3 as file cache and memcached as discussed in this article. Xcache and APC would be opcode caching solutions for phpfox v3.

For the testing purpose, we kept the settings for apache webserver and mysql as default so result may be different in case these resources are optimized. Also there was minimal data on the website so result may also vary depending on the contents of the website.

Testing Environment:

  • Operating System: 2.6.35.14-106.53.amzn1.x86_64
  • Web Server:  Apache/2.2.21 (Unix)
  • PHP: PHP 5.3.10
  • CPU: Intel(R) Xeon(R) CPU E5430  @ 2.66GHz
  • Main Memory: 7652592k

Test Results:

Memcached

Concurrency Level:      10
Time taken for tests:   103.594 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      29972124 bytes
HTML transferred:       29559780 bytes
Requests per second:    9.65 [#/sec] (mean)
Time per request:       1035.940 [ms] (mean)
Time per request:       103.594 [ms] (mean, across all concurrent requests)
Transfer rate:          282.54 [Kbytes/sec] received

APC

Concurrency Level:      10
Time taken for tests:   82.830 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      30110000 bytes
HTML transferred:       29696000 bytes
Requests per second:    12.07 [#/sec] (mean)
Time per request:       828.295 [ms] (mean)
Time per request:       82.830 [ms] (mean, across all concurrent requests)
Transfer rate:          355.00 [Kbytes/sec] received

Xcache

Concurrency Level:      10
Time taken for tests:   86.303 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      30110000 bytes
HTML transferred:       29696000 bytes
Requests per second:    11.59 [#/sec] (mean)
Time per request:       863.026 [ms] (mean)
Time per request:       86.303 [ms] (mean, across all concurrent requests)
Transfer rate:          340.71 [Kbytes/sec] received

Plain php

Concurrency Level:      10
Time taken for tests:   157.491 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      30110000 bytes
HTML transferred:       29696000 bytes
Requests per second:    6.35 [#/sec] (mean)
Time per request:       1574.913 [ms] (mean)
Time per request:       157.491 [ms] (mean, across all concurrent requests)
Transfer rate:          186.70 [Kbytes/sec] received

Conclusion

As per our test cases, Both APC and Xcache provides a great performance boost to phpfox v3 than memcached/Simple File Cache (No Opcode) on a single machine. APC remain faster ~5% better than Xcache, ~25% better than memcached and ~90% better than plan php. So we think using either APC or Xcache shall boost the performance of your social community based on phpfox v3. If you have phpfox v3 running multiple servers then you should consider memcached as caching solution.

It is possible to do performance tuning by yourself, or getting developers to do this. However, in our experience, the community owners are really more focused on making their community an engaging experience via functionality or graphics. Similarly, most developers can write PHP code, but very few have the experience of various tools for improving performance. One of the solutions we thought was to bake this optimization right into the hosting, so we have teamed up with Acenet hosting to provide you hosting for SocialEngine and Phpfox with built-in PHP, web server and database performance enhancements. Custom optimization may be required when your community grows huge, but that is different for everyone and we will continue to provide it as a separate service.

phpfox v3 performance optimization : Xcache or APC or Memcached or File Cache was last modified: April 11th, 2016 by Kapil Jain