~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/zeromq/docs/index.rst

  • Committer: Marcus Eriksson
  • Date: 2011-08-08 18:51:23 UTC
  • mto: This revision was merged to the branch mainline in revision 2391.
  • Revision ID: marcuse@marcuse-laptop-20110808185123-32136r30h10d0irj
add schema as first frame and add some initial docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
ZeroMQ integration
 
2
==================
 
3
ZeroMQ is a messaging library that allows you to easily build complex
 
4
communication systems. The ZeroMQ plugin allows drizzle to publish
 
5
transactions to a local PUB socket. Many clients can subscribe to
 
6
these transactions. The first frame of the message sent out is the
 
7
schema name the transaction touched - this enables clients to only
 
8
subscribe to the interesting schemas (note that certain "transactions"
 
9
are without a schema, like SET xyz for example, for these, the first
 
10
frame is empty).
 
11
 
 
12
Getting started
 
13
---------------
 
14
First, install zeromq, get the code from `zeromq.org
 
15
<http://zeromq.org>`_, then you can build drizzle, watch the
 
16
./configure output to verify that drizzle finds the libraries needed.
 
17
 
 
18
Now you are good to go, simply start drizzle with --plugin-add=zeromq
 
19
and drizzle will start publishing transactions. The only configuration
 
20
parameter available is:
 
21
 
 
22
.. code-block:: bash
 
23
 
 
24
  --zeromq.endpoint arg (=tcp://*:9999) - the endpoint to expose.
 
25
 
 
26
Now you can write a simple python script to verify that it works,
 
27
something like this will work:
 
28
 
 
29
.. code-block:: python
 
30
 
 
31
  import zmq
 
32
 
 
33
  ctx = zmq.Context()
 
34
  s = ctx.socket(zmq.SUB)
 
35
  s.setsockopt(zmq.SUBSCRIBE, '')
 
36
  s.connect('tcp://localhost:9999')
 
37
  i = 0
 
38
  while True:
 
39
      i = i+1
 
40
      s.recv_multipart()
 
41
      print i
 
42
 
 
43
and then you can generate some load:
 
44
 
 
45
.. code-block:: bash
 
46
 
 
47
  bin/drizzleslap -c 10 -a --auto-generate-sql-add-autoincrement --burnin
 
48
 
 
49
which creates 10 threads and generates random queries.