- I found an event in my code, through which task doesn't return 'true'. In gearman protocol, compleated task must return 'true'.
- I setup gearman config without persistance storage.
OPTIONS="--listen=127.0.0.1
--job-retries=3 \
--log-file=/var/log/gearman.log \
--threads=12"
З. I add more threads for gearman job-server with '--threads=threds_count' parameter.
And now my system works fast and stable! :)
If you using persistance storage and your queue are overflowing: you can periodically run script to clean gearman_queue. I solved it with periodically calling sh script ( I use cron for this ):
# stop gearman
sudo /etc/init.d/gearman stop
# delete tasks from DB
mysql -Bse 'DELETE FROM queue' gearman -u root
# start gearmand back
sudo /etc/init.d/gearman start
echo '*** gearman queue cleaned. ***'