apachebench - Queuing data to redis with php-resque is slow -
i'm using php-resque queuing jobs. , i'm doing apache ab tool benchmark performance.
php-resque
job, it's slow every time connects redis impacts performance (without connection handles ~130 requests/sec
, resque::enqueue
it's ~30 requests/sec
).
so thinking pass data file through exec
connect redis , queus job in background, found exec
way slow.
what next ? how can make handle redis queuing faster.
note: i'm using command test performance.
ab -n 1000 -c 10 "http://localhost/index.php"
i found way.
here steps:
after digging php-resque
found it's using fsockopen makes slow.
then installed php-redis
on ubuntu machine. executing following command.
sudo apt-get install php5-redis
then restarted apache server :
sudo service apache2 restart
and connected redis following lines of code.
<?php $redis = new redis(); $result = $redis->connect('127.0.0.1'); $id = md5(uniqid('', true)); $redis->set("resque:job:$id",$args); $redis->close(); unset($redis);
after code testing gave better performance (~70 requests/second)
doubled before.
note: here pconnect
stands persistent connection, faster connect
.
hope helps someone.
Comments
Post a Comment