I'm using php-resque for queuing my jobs. And I'm doing apache ab tool to benchmark my performance.
php-resque does good job, but it's slow as every time my it connects to redis which impacts performance (without connection it handles ~130 Requests/sec and with Resque::enqueue it's ~30 requests/sec).
So I was thinking to pass data to another file through exec which will connect redis and queus job in the background, but found that exec is way much slow.
What is next ? How can I make it handle redis queuing faster.
Note: I'm using this command to test performance.
ab -n 1000 -c 10 "http://localhost/index.php"
I found a way.
Here are the steps:
After digging
php-resqueI found that it's using fsockopen which makes it slow.Then I installed
php-redison my ubuntu machine. By executing following command.Then restarted apache server by :
And then connected with redis by following lines of code.
After this code testing with gave better performance
(~70 requests/second)which is doubled than before.Note: here
pconnectstands for persistent connection, which is faster thanconnect.Hope this helps someone.