beanstalkd源于fackbook,是一個快速、簡單的內存消息隊列,也可以開啟binlog,消息將被寫入日志文件,用于重啟時恢復數據。
1.消息被稱作job,在服務器端儲存在內存隊列中,具有DELAYED,READY,RESERVED,BURIED狀態,狀態轉換圖如下
Here is a picture of the typical job lifecycle:
put reserve delete
-----> [READY] ---------> [RESERVED] --------> *poof*
Here is a picture with more possibilities:
put with delay release with delay
----------------> [DELAYED] <------------.
| |
| (time passes) |
| |
put v reserve | delete
-----------------> [READY] ---------> [RESERVED] --------> *poof*
^ ^ | |
| \ release | |
| `-------------' |
| |
| kick |
| |
| bury |
[BURIED] <---------------'
|
| delete
`--------> *poof*
消息支持優先級,生存時間的設置。不同狀態的消息分別處于相應狀態的隊列中。
2. 消息屬于某個tube,tube類似于namespace或者消息主題的概念,消費者可以訂閱一個或多個tube ,從而接收這些tube的消息 。
3. beanstalkd的代碼實現和協議定義很類似memcached的風格。