This document contains benchmark information of various messaging system such as 0MQ, Kafka, RabbitMQ, SQS, etc.
Unfortunately, you can't download this document. But if you want to get this, please send email to us(support@osci.kr)
2. 2
- Internal Use Only -
Basic Process
Database/NoSQL
Gateway ModuleAPI Module
Web AppsFunction
Component 1
Service Layer
Business Layer
Data Access Layer
Component 2
Service Layer
Business Layer
Data Access Layer
API Access
2. Put
1. API call
(Servlet Param)
…
Messaging or Task
3. Reply(JSON)
4. Deliver Msg to Component
Client, CP/SP
Queue
DescriptionComponent
API Module
• Polling data, data parsing
• Send parsed data to message queue
Gateway Module
• Subscribe from message queue, retrieve room data from data stores
• Send data to Push Server
• Consumer pool
3. 3
- Internal Use Only -
Kafka Performance Test – 2.8 Ghz, 4core, 8GB memory
Producer Batch-size 200
[jboss@localhost kafka-0.7.0]$ ./bin/kafka-producer-perf-test.sh --brokerinfo broker.list=0:localhost:9092 --messages 100000 --topic test --threads 1 --message-size 2048
[2012-05-28 09:02:31,236] INFO Creating sync producer for broker id = 0 at localhost:9092 (kafka.producer.ProducerPool)
[2012-05-28 09:02:37,730] INFO Disconnecting from localhost:9092 (kafka.producer.SyncProducer)
[2012-05-28 09:02:37,733] INFO Total Num Messages: 100000 bytes: 204800000 in 6.567 secs (kafka.tools.ProducerPerformance$)
[2012-05-28 09:02:37,742] INFO Messages/sec: 15227.6534 (kafka.tools.ProducerPerformance$)
[2012-05-28 09:02:37,742] INFO MB/sec: 29.7415 (kafka.tools.ProducerPerformance$)
[jboss@localhost kafka-0.7.0]$
Consumer
[2012-05-28 09:02:49,552] INFO Consumer test-consumer-group_localhost.localdomain-1338210169298-69d7d792 selected partitions : test:0-0: fetched offset = 2102058861: consumed offset
= 2102058861 (kafka.consumer.ZookeeperConsumerConnector)
[2012-05-28 09:02:49,558] INFO end rebalancing consumer test-consumer-group_localhost.localdomain-1338210169298-69d7d792 try #0 (kafka.consumer.ZookeeperConsumerConnector)
[2012-05-28 09:02:49,560] INFO Sleeping for 5 seconds. (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:02:49,561] INFO FetchRunnable-0 start fetching topic: test part: 0 offset: 2102058861 from 127.0.0.1:9092 (kafka.consumer.FetcherRunnable)
[2012-05-28 09:02:54,561] INFO starting threads (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:20,065] INFO thread[7], nMsgs:100000 bytes:204800000 nMsgs/sec:3923.57 MB/sec:7.66 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,065] INFO thread[9], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,067] INFO thread[8], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,070] INFO thread[7], nMsgs:100000 bytes:204800000 nMsgs/sec:2597.47 MB/sec:5.07 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,073] INFO thread[6], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,075] INFO thread[5], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,077] INFO thread[4], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
[2012-05-28 09:03:33,078] INFO thread[3], nMsgs:0 bytes:0 nMsgs/sec:0.00 MB/sec:0.00 (kafka.tools.ConsumerPerformance$)
DescriptionLocation
Producer
• Batch-size가 1일 경우 상당한 퍼포먼스 문제
• 위의 테스트는 batch-size 200으로 처리(200개 메시지 들어올 경우 flush)
Consumer
• Multi consumer 일 경우라 하더라도 하나의 파티션에 대해 하나의 consumer만 처리
• Consumer pool이 하나의 디스크로 인하여 의미가 없음
• Consumer pool
Producer Batch-size 1
[jboss@localhost kafka-0.7.0]$ ./bin/kafka-producer-perf-test.sh --brokerinfo broker.list=0:localhost:9092 --messages 100000 --topic test --threads 1 --message-size 2048 --batch-size 1
[2012-05-28 09:25:10,494] INFO Closing all sync producers (kafka.producer.ProducerPool)
[2012-05-28 09:25:10,494] INFO Disconnecting from 127.0.0.1:9092 (kafka.producer.SyncProducer)
[2012-05-28 09:25:10,510] INFO thread 2: 10000 messages sent 1682.3688 nMsg/sec 0.1604 MBs/sec (kafka.tools.ProducerPerfor mance$SyncProducerThread)
[2012-05-28 09:25:10,510] INFO Closing all sync producers (kafka.producer.ProducerPool)
[2012-05-28 09:25:10,510] INFO Disconnecting from 127.0.0.1:9092 (kafka.producer.SyncProducer)
[2012-05-28 09:25:10,512] INFO thread 3: 10000 messages sent 1769.9115 nMsg/sec 0.1688 MBs/sec (kafka.tools.ProducerPerfor mance$SyncProducerThread)
http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01016.html
5. 5
- Internal Use Only -
Amazon SNS, SQS
Message send cost : avg 0.125 sec per message
Sender 1
Sender 2
Receiver 1
Receiver 2
[SQS Architecture]
Sender 1
Sender 2
Receiver 1
Receiver 2
Web Application Server
Endpoint URL
Queue
[SNS Architecture]
DescriptionLocation
Producer
• Sending part is HTTP client method call
• Sending speed is very slow
• Call public DNS
Consumer
• Processing time on receiver depends on web application server performance
• Consumer is processed by web application server thread
• HTTP Thread
6. 6
- Internal Use Only -
Comparison
Criteria Netty Kafka SNS
Short Response
Time
Short Messaging Routes Short Short Long
Connection Handshake Cost
Low
(Connection Pooling Supported)
Middle
(Handshakes on
producers/consumers)
High
(HTTP Connectionless Only)
Asynchronous Processing
Async / Sync Supported Async Supported Async Supported
(HTTP Long Pooling)
Light-weight Software Stacks
Light Light Heavy
High Availability
No Single Point of Failures
SPF exists
(Zookeeper Required)
HA Supported
(Zookeeper Embedded by default)
HA Supported
References
Twitter, Plurk, Eucalyptus,
Siemens
Linked-in, Tumblr (used for
message store, NOT pub/sub)
AWS customers
Minimum System
Complexity
Supported Data Formats
Web Socket, Protobuf, POJO,
Text, Avro, Thrift, Byte Array
Byte Array only Text only
Simple Object Model
Simple Complex
(Kafka’s topic object model does
not fit into the event model)
Simple
Minimum System
Complexity
Easy Configuration /
Hot-deployable /
Auto-scalable
Yes Yes Yes
Remarks
Zookeeper required High-speed disk I/O required Callback web app required
8. 8
- Internal Use Only -
ØMQ Overview
Features
Intelligent socket library for messaging
Many kinds of connection patterns
Multiplatform, multi-language (30+)
Fast (8M msg/sec, 30usec latency)
Small (20K lines of C++ code)
Open source LGPL (large community)
[Basic] [Forwarding]
[Pub/Sub] [Broadcast]
9. 9
- Internal Use Only -
ØMQ Throughput – 4 core, 8GB Memory
[root@localhost perf]# ./local_thr.sh
tcp://eth0:5555 1024 100000
message size: 1024 [B]
message count: 100000
mean throughput: 39968[msg/s]
mean throughput: 327.417856[Mb/s]
1Kb Message
[root@localhost perf]# ./remote_thr.sh
tcp://192.168.56.101:5555 1024 100000
Sent elapsed time : 2.339 sec
Sender Receiver
[root@localhost perf]# ./local_thr.sh
tcp://eth0:5555 2048 100000
message size: 2048 [B]
message count: 100000
mean throughput: 49504[msg/s]
mean throughput: 811.073536[Mb/s]
2Kb Message
[root@localhost perf]# ./remote_thr.sh
tcp://192.168.56.101:5555 2048 100000
Sent elapsed time : 1.499 sec
4Kb Message
[root@localhost perf]# ./local_thr.sh
tcp://eth0:5555 4096 100000
message size: 4096 [B]
message count: 100000
mean throughput: 29446[msg/s]
mean throughput: 964.886528[Mb/s]
[root@localhost perf]# ./remote_thr.sh
tcp://192.168.56.101:5555 4096 100000
Sent elapsed time : 2.137 sec
10Kb Message
[root@localhost perf]# ./local_thr.sh
tcp://eth0:5555 10240 100000
message size: 10240 [B]
message count: 100000
mean throughput: 13048[msg/s]
mean throughput: 1068.89216[Mb/s]
[root@localhost perf]# ./remote_thr.sh
tcp://192.168.56.101:5555 10240 100000
Sent elapsed time : 3.091 sec
11. 11
- Internal Use Only -
Comparison – RabbitMQ vs. ØMQ
Criteria RabbitMQ Ø MQ
Short Response
Time
Short Messaging Routes Short Short
Performance
(Based on 10Kb)
2798 msg/sec
4.66 times faster than RabbitMQ – 13048
msg/sec
Asynchronous
Processing
Sync, Async Supported Async based event processing
Light-weight Software
Stacks
Light More Light
High Availability
No Single Point of
Failures
HA Cluster Support No Broker Architecture
Flexibility
Supported Data Formats Various(JSON, POJO, etc.) Various(JSON, Thrift, Google ProtoBuf, etc.)
Easy Configuration GUI Based Configuration Implementation needed
Runtime Configuration Runtime deploy for queue, topic Implementation needed
Commercial Support SpringSource(VMWare) iMatrix
Monitoring Many plugin for monitoring, web based GUI Implementation needed
Remarks
• Powerful web based monitoring
• AMQP1) Support
• Dynamic topic management
• Easy of Development
• High throughput/Low latency
• Auto reconnect among peer
• Run on arbitrary platforms (Windows,
Android)
1) AMQP(Asynchronous Message Queuing Protocol) : Supported by Microsoft, Red Hat, VMware, Cisco, Novell, SoftwareAG, etc.
Ø MQ is very lightweight and fast, but we’ll have to implement most of features ourselves
Flexibility, reliability, and easy to use are important in this project, not performance
13. 13
- Internal Use Only -
Install
Ø MQ core is built using C language
Prerequisites : autoconf, automake, gcc, gcc-g++, make, git, java, libtool
[Documents]
ZeroMQ : http://www.zeromq.org/
ZeroMQ Java : http://www.zeromq.org/bindings:java
Guide : http://zguide.zeromq.org/page:all
Korean : http://kr.zeromq.org/
[ZeroMQ Core Install]
wget http://download.zeromq.org/zeromq-2.2.0.tar.gz
tar -zxvf zeromq-2.2.0.tar.gz
cd zeromq-2.2.0
./configure --with-pgm Multicast support
make
sudo make install
[ZeroMQ Java Install]
git clone https://github.com/zeromq/jzmq.git
cd jzmq
./autogen.sh
./configure
make
sudo make install
14. 14
- Internal Use Only -
Client/Server
import org.zeromq.ZMQ;
public class hwclient {
public static void main (String[] args){
ZMQ.Context context = ZMQ.context (1);
ZMQ.Socket socket = context.socket (ZMQ.REQ);
socket.connect ("tcp://localhost:5555");
socket.send ("Hello", 0);
System.out.println (socket.recv(0));
}
}
import org.zeromq.ZMQ;
public class hwserver {
public static void main (String[] args) {
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.REP);
socket.bind ("tcp://*:5555");
while (true) {
byte [] request = socket.recv (0);
socket.send("World", 0);
}
}
}
15. 15
- Internal Use Only -
Queue Load Balancing
import zmq
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://127.0.0.1:5000")
socket.connect("tcp://127.0.0.1:6000")
for i in range(10):
msg = "msg %s" % i
socket.send(msg)
print "Sending", msg
msg_in = socket.recv()
import zmq
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://127.0.0.1:5000")
while True:
msg = socket.recv()
print "Got", msg
socket.send(msg)
import zmq
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://127.0.0.1:6000")
while True:
msg = socket.recv()
print "Got", msg
socket.send(msg)
Each server will be received five messages equivalently
16. 16
- Internal Use Only -
Broadcast - Pub/Sub
import zmq
from random import choice
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://127.0.0.1:5000")
countries = ['netherlands','brazil','germany','portugal']
events = ['yellow card', 'red card', 'goal', 'corner', 'foul']
while True:
msg = choice( countries ) +" "+ choice( events )
print "->",msg
socket.send( msg )
import zmq
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect("tcp://127.0.0.1:5000")
socket.setsockopt(zmq.SUBSCRIBE, "netherlands")
socket.setsockopt(zmq.SUBSCRIBE, "germany")
while True:
print socket.recv()
Subscriber will be received only “netherlands” and “germany”