Beanstalkd,一個高性能、輕量級的分佈式內存隊列系統,最初設計的目的是想通過後臺異步執行耗時的任務來降低高容量Web應用系統的頁面訪問延遲,支持過有9.5 million用戶的Facebook Causes應用。
wget https://github.com/downloads/kr/beanstalkd/beanstalkd-1.6.tar.gz
tar -xzvf beanstalkd-1.6.tar.gz
make && make install
安裝php擴展
git clone https://github.com/nil-zhang/php-beanstalk.git
git clone https://github.com/bergundy/libbeanstalkclient.git
先安裝libbeanstalkclient,然後繼續php擴展安裝
cd php-beanstalk
phpize
./configure
make && make install
python客戶端安裝
git clone https://github.com/earl/beanstalkc.git
cd beanstalk
python setup.py install
在運行時如果報:Failed to load PyYAML, will not parse YAML
則需要安裝python的依賴組件:pip install pyyaml 進行安裝
核心概念:
特性:
後臺啓動:
beanstalkd -l 地址 -p 端口號 -z 最大的任務大小(byte) -c &
如果是外部客戶端連接,ip地址要寫外網地址,這樣才能連接上
啓動選項
-b DIR wal directory
-f MS fsync at most once every MS milliseconds (use -f0 for "always fsync")
-F never fsync (default)
-l ADDR listen on address (default is 0.0.0.0)
-p PORT listen on port (default is 11300)
-u USER become user and group
-z BYTES set the maximum job size in bytes (default is 65535)
-s BYTES set the size of each wal file (default is 10485760)
(will be rounded up to a multiple of 512 bytes)
-c compact the binlog (default)
-n do not compact the binlog
-v show version information
-V increase verbosity
-h show this help