β

nodeMQ 基于nodejs和Redis的开源消息队列系统

web架构研究 4073 阅读

nodeMQ 是基于Nodejs 和Redis 开发的消息队列系统,目前仅仅是beta版本。

支持简单的put get操作,采用http协议访问。项目地址:https://github.com/lnmp/nodemq

Redis client 采用的是 https://github.com/tristandunn/node-redis-client

基于Redis 数据库,可以方便进行性能调优,和支持分布式的消息队列,nodejs 自身又可作为webserver,二次开发也非常方便,全部代码才100多行,这仅仅是第一个beta版本,后面考虑添加监控运行状态的功能和提升性能

==============================================
使用说明
put 操作

curl "http://10.0.0.106:8000/put?data=xxxxxxxxxx"

get 操作

curl "http://10.0.0.106:8000/get"

===========================================
安装&使用
安装nodejs和Redis之后,

git clone https://github.com/lnmp/nodemq.git
cd nodemq

config.js 负责配置nodemq server 和redis的端口和域名

运行nodemq 也非常简单

node index.js

==============================================
压力测试数据 原生配置文件,对Redis没有进行任何优化

put操作压力测试

[libo@search106 src]$ webbench -t 10 -c 100 http://10.0.0.106:8000/put?data=xxxxxxxxxx
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/put?data=xxxxxxxxxx
 clients, running 10 sec.
 
Speed=242718 pages/min, 307442 bytes/sec.
Requests: 40453 susceed, 0 failed.
 
 
[libo@search106 src]$ webbench -t 10 -c 300 http://10.0.0.106:8000/put?data=xxxxxxxxxx
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/put?data=xxxxxxxxxx
 clients, running 10 sec.
 
Speed=247836 pages/min, 315873 bytes/sec.
Requests: 41306 susceed, 0 failed.
 
 
[libo@search106 src]$ webbench -t 10 -c 500 http://10.0.0.106:8000/put?data=xxxxxxxxxx
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/put?data=xxxxxxxxxx
 clients, running 10 sec.
 
Speed=237558 pages/min, 304866 bytes/sec.
Requests: 39593 susceed, 0 failed.

get 操作压力测试

[libo@search106 src]$ webbench -t 10 -c 100 http://10.0.0.106:8000/get
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/get
 clients, running 10 sec.
 
Speed=287718 pages/min, 359655 bytes/sec.
Requests: 47953 susceed, 0 failed.
 
 
 
[libo@search106 src]$ webbench -t 10 -c 300 http://10.0.0.106:8000/get
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/get
 clients, running 10 sec.
 
Speed=298908 pages/min, 373635 bytes/sec.
Requests: 49818 susceed, 0 failed.
 
 
[libo@search106 src]$ webbench -t 10 -c 500 http://10.0.0.106:8000/get
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
 
Benchmarking: GET http://10.0.0.106:8000/get
 clients, running 10 sec.
 
Speed=294066 pages/min, 367582 bytes/sec.
Requests: 49011 susceed, 0 failed.

========================================
补充说明:

2011.08.29
压力测试数据很不给力,性能上还要继续完善

作者:web架构研究
专注于互联网开发,不断探索新技术
原文地址:nodeMQ 基于nodejs和Redis的开源消息队列系统, 感谢原作者分享。