tags:

views:

63

answers:

1

Is there any simple test I can try to benchmark APC and Memcache, just to get a sense of the performance benefits of using them?

I tried some simple stuff using microtime() and looping requests to my database and storing the results, first in cache and then without, but I didn't notice any significant performance boost.

Thanks.

A: 

The real benefit is not easy to test. The problem is the are they help with is concurrency, not just page execution time... And that's a non-trivial thing to test.

One option, would be to use ab (Apache Bench) to issue repeated HTTP requests to the same page, and measure the difference in request rate and load...

ab -c 20 -n 1000 http://www.example.com/index.php

The -c 20 says to use 20 concurrent clients (simulating 20 simultaneous users). The -n 1000 says to make a total of 1000 requests. Then, look at both the Time Per Request and the Requests Per Second fields. Play around with different APC/Memcache settings (even disabling them) to watch how those figures change...

ircmaxell
Thanks a lot. When I disable APC and Memcache, and run the command, I get the following: apr_socket_recv: An existing connection was forcibly closed. But when APC and Memcache are active, I don't get the error. Do you know what might be causing this? I'm using Windows and XAMPP (PHP 5.3.1)
Chuck Ugwuh
Check your PHP and Apache error logs. The chances are that something either segfaulted, or php died because of some other reasons...
ircmaxell