[文章作者:张宴 本文版本:v1.0 最后修改:2010.03.18 转载请注明原文链接:http://blog.zyan.cc/httpsqs_1_2/]

  HTTPSQS(HTTP Simple Queue Service)是一款基于 HTTP GET/POST 协议的轻量级开源简单消息队列服务,使用 Tokyo Cabinet 的 B+Tree Key/Value 数据库来做数据的持久化存储。

  项目网址http://code.google.com/p/httpsqs/
  使用文档http://blog.zyan.cc/httpsqs/
  使用环境:Linux(同时支持32位、64位操作系统,推荐使用64位操作系统)
  软件作者:张宴

  队列(Queue)又称先进先出表(First In First Out),即先进入队列的元素,先从队列中取出。加入元素的一头叫“队头”,取出元素的一头叫“队尾”。利用消息队列可以很好地异步处理数据传送和存储,当你频繁地向数据库中插入数据、频繁地向搜索引擎提交数据,就可采取消息队列来异步插入。另外,还可以将较慢的处理逻辑、有并发数量限制的处理逻辑,通过消息队列放在后台处理,例如FLV视频转换、发送手机短信、发送电子邮件等。



  HTTPSQS 具有以下特征:

  ● 非常简单,基于 HTTP GET/POST 协议。PHP、Java、Perl、Shell、Python、Ruby等支持HTTP协议的编程语言均可调用。
  ● 非常快速,入队列、出队列速度超过10000次/秒。
  ● 高并发,支持上万的并发连接,C10K不成问题。
  ● 支持多队列。
  ● 单个队列支持的最大队列数量高达10亿条。
  ● 低内存消耗,海量数据存储,存储几十GB的数据只需不到100MB的物理内存缓冲区。
  ● 可以在不停止服务的情况下便捷地修改单个队列的最大队列数量。
  ● 可以实时查看队列状态(入队列位置、出队列位置、未读队列数量、最大队列数量)。
  ● 可以查看指定队列ID(队列点)的内容,包括未出、已出的队列内容。
  ● 查看队列内容时,支持多字符集编码。
  ● 源代码不超过700行,适合二次开发。



  HTTPSQS 1.2 版本增加的功能:

  1、服务器端:

  ● PUT入队列、GET出时,1.2版本在Header头增加了一行Pos,输出当前队列“写入点”或“读取点”。假设从队列取出一条消息,这条消息的队列读取点Pos为7,将这条消息插入数据库失败了,那么,就可以在失败Pos日志文件中记录这个队列点。过段时间后,只要该Pos点的数据未被覆盖,通过“http://127.0.0.1:1218/?charset=utf-8&name=your_queue_name&opt=view&pos=7”则可以再次取出该条消息,做失败原因分析或进一步处理。

  ● PUT入队列时,如果“队列写入点”追上“队列读取点”,会返回“HTTPSQS_PUT_END”,提示队列已满,而不是像1.1版本那样直接覆盖未读数据。

  2、客户端:

  ● 增加了Perl版本的客户端。感谢网友tonny0830为HTTPSQS开发了Perl客户端。

  ● PHP客户端Class增加了函数$httpsqs->gets($host, $port, $charset, $name)、$httpsqs->pgets($host, $port, $charset, $name),详细使用说明请见:http://blog.zyan.cc/httpsqs/



  HTTPSQS 1.1 版本如何升级到 HTTPSQS 1.2 版本:

  ●服务器端版本完全兼容:编译安装 HTTPSQS 1.2,替换 HTTPSQS 1.1,然后“kill httpsqs的进程ID”,按原来的启动参数启动 HTTPSQS 即可,数据完全兼容。

  ●客户端版本完全兼容:HTTPSQS 1.1 版本的PHP客户端,仍可以直接操作 HTTPSQS 1.2。两个版本的PHP客户端函数使用方式、参数相同,1.2 版本的PHP客户端与 1.1 版本相比,增加了gets()和pgets()函数,用于从一个队列中取出文本信息和当前队列读取点Pos。



  HTTPSQS 1.2 的生产环境典型应用案例架构:

  点击在新窗口中浏览此图片



  HTTPSQS 1.2 版本的详细使用说明,请访问:http://blog.zyan.cc/httpsqs/






技术大类 » Cache与存储 | 评论(46) | 引用(0) | 阅读(65657)
网友
2010-11-19 14:46
架构图是用什么软件画的啊?急需绘制类似图形。 盼回复
thesnake
2010-12-16 17:22
你们问问题不先看一眼回帖么 - -
Kenshin
2011-2-12 11:52
开发一网页游戏使用了httpsqs和memcache,PHP+MYSQL数据库。httpsqs写入数据库为定时写入,memcache缓存为即时写入,那么怎么获得写入MYSQL数据库数据的自动增量呢?用PHP缓存判断并生成这个值,点击页面速度快时候会重复。
mrguo
2011-8-5 13:27
能问一下:curl "http://host:port/?name=your_queue_name&opt=put&data=经过URL编码的文本消息&auth=mypass123"中a.每一个新name值是不是就是一个新队列?b.这个组件最大支持同时开启多少个队列?c.我对每个不同投放数据的业务都分配一个不同的name这样方便取值,但不清楚业务多了,会不会在性能上降低
louis vuitton uk Email Homepage
2011-11-22 17:07
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
armani watches Email Homepage
2011-11-23 10:10
If you are looking for armani Bags, our armani watches Handbags Canada outlet store is your first choice. We promise Original Packing and Best Discount,3-5 Workdays To Your Door!If you buy bags and purses of the latest new designs from the louis vuitton outlet now, you can enjoy special discounts. What else are you waiting for?After you choose the right kind of plants and the size pot for the plant.
wedding520 Email Homepage
2011-12-27 15:56
ワイドネックライン、'V'ネックやボートネックラインは、一般にキャップスリーブとドレスのために選ばれている。ボートスタイルのネックラインと幅広いネックラインのためには、オフショルダーのキャップスリーブを追加することができます。オフショルダーのウエディングドレスは、数年以来、結婚式の摩耗で人気のパターンになっても流行で、今日でもあります。カラードレス 格安.のこのスタイルで素敵に見える模様のオフショルダーの袖に行く同じシースのサテンからステッチ/オフショルダーのキャップスリーブの上に薄いと飾ったときに裾フレアのビットとシースのサテンのイブニングドレスとスパゲッティネックラインがすごい見えます。
Hogan Email Homepage
2012-5-10 17:55
Ci sono diversi motivi principali per cui si può sicuramente trovare sul proprio volere le soluzioni contabili che coinvolgono tutta Stansted, anche se alcune persone potrebbero uomini e donne, probabilmente si dovrà disporre di soluzioni contabili rispetto con la gente. Stai con me per scoprire di più su molti dei motivi per prendere in considerazione l'impiego contabili in tutta Hogan Stansted. Costruire un businessIf vi capita di essere in funzione, è abbastanza possibile che si può fare uso di soluzioni contabili. Non date per scontato tutte le società hanno abbastanza soldi per utilizzare a tempo pieno il personale fiscali, così utilizzando una conditi insieme con l'agenzia affidabile che coinvolge tutta commercialisti Stansted potrebbe rendere meno difficili problemi.
hogan280 Email
2012-5-10 18:07
Nazir Afzal, il pubblico ministero appena nominato capo nazionale per il Nord Ovest, che era responsabile per portare i responsabili in giudizio, ha detto al Guardian: "Non era la loro gara che li ha definiti, è stato il loro trattamento delle Hogan donne". Prima di aggiungere: "Non c'è nessuna comunità in cui le donne e le ragazze non sono vulnerabili agli attacchi sessuali e questo è un dato di fatto."
磨延城 Email Homepage
2013-10-21 20:46
磨途歌学习了
django Email Homepage
2013-11-30 19:01
Uggs Sale the ideal idea Coach Outlet Online  enough time to search for many of reduction Ugg boot. Like big portions? If you began ready your apartment, Coach Outlet  it's always best to consider the most effective way direct to the stage it could be to utilise your inventory throughout Coach Factory Outlet  concern, or maybe you basically won't destination stuff not enough.we're anti- whitening tray because Coach Outlet Online  i will be enjoy just get germ dog breeders
Steven Email Homepage
2015-3-19 02:41
Thank you for this post Weight Loss Tea
steven Email Homepage
2015-3-20 22:25
Thank you asphalt 8 cheats
Elena Mathew Email
2021-4-29 11:03
I got curious on your site. So i digged into your first page.You have a very user friendly site. For me, its a little harder how i make so familiar in every site i visited and yours is unique. Great Job.บาคาร่าออนไลน์ ได้เงินจริง
Paulojimmathew Email
2021-7-29 12:34
Much obliged. Thanks! , dude. As usual, you come through like a champ! I like your work.  เกมบาคาร่า
Ieuan Ventura Email
2021-10-20 18:01
Strategic goals, Team work and Communication is the key with our industry. Following tracks may also lead us to success. Its always been grateful for the opportunity you gave us all. Have a nice day.  คาสิโนออนไลน์สล็อต
分页: 2/3 第一页 上页 1 2 3 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]