9. What is Q4M?
A message queue
runs as a storage plugin of MySQL 5.1
Why is it a MySQL plugin?
accessible by using existing MySQL clients
no need for a new client library
administrable by using SQL
friendly to DB admins
First release: Jan 2008
2011 7 16 9
10. Design Goals of Q4M
Robust
Does not lose data on OS crash or power failure
necessary for Tokyo wo. nuclear power plants… orz
Fast
Transfer thousands of messages per second
Easy to Use
Use SQL for access / maintenance
Integration into MySQL
no more separate daemons to take care of
2011 7 16 10
11. Users of Q4M
Many leading web services in Japan
DeNA Co., Ltd.
livedoor Co., Ltd.
mixi, Inc.
Zynga Japan (formerly Unoh, Inc.)
2011 7 16 11
13. What is a Message Queue?
Middleware for persistent asynchronous
communication
communicate between fixed pairs (parties)
a.k.a. Message Oriented Middleware
MQ is intermediate storage
RDBMS is persistent storage
Senders / receivers may go down
2011 7 16 13
14. Minimal Configuration of a Message Queue
Senders and receivers access a single
queue
Sender Receiver
Queue
2011 7 16 14
15. Using MQ as a Relay
Separate queue for sender and receiver
Messages relayed between queues
Relay
Sender Receiver
Queue Queue
2011 7 16 15
16. Merits of using Message Relays
Destination can be changed easily
Relays may transfer messages to different
locations depending on their headers
Robustness against network failure
no loss or duplicates when the relay fails
Logging and Multicasting, etc.
2011 7 16 16
17. Message Brokers
Publish / subscribe model
Separation between components and their
integration
Components read / write to predefined queues
Integration is definition of routing rules between
the message queues
Messages are often transformed (filtered) within
the relay agent
2011 7 16 17
18. What about Q4M?
Q4M itself is a message queue
Can connect Q4M instances to create a
message relay
Provides API for creating message relays
and brokers
2011 7 16 18
19. Performance of Q4M
over 7,000 mess/sec.
message size: avg. 512 bytes
syncing to disk
Outperforming most needs
if you need more, just scale out
Can coexist with other storage engines without
sacrificing their performance
see http://labs.cybozu.co.jp/blog/kazuhoatwork/2008/06/q4m_06_release_and_benchmarks.php
2011 7 16 19
20. Q4M in DeNA
uses Q4M for sending notifications
asynchronously
http://engineer.dena.jp/2010/03/dena-technical-
seminar-1-2.html
2011 7 16 20
21. Q4M in DeNA
Q4M
2,000 /
DeNA
2011 7 16 21