summaryrefslogtreecommitdiff
path: root/doc/source/user/drivers.rst
blob: 3d3fdd3c43fc151cf7481c32128f953fb8d0a2ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
=======
Drivers
=======

Tooz is provided with several drivers implementing the provided coordination
API. While all drivers provides the same set of features with respect to the
API, some of them have different characteristics:

Zookeeper
---------

**Driver:** :py:class:`tooz.drivers.zookeeper.KazooDriver`

**Characteristics:**

:py:attr:`tooz.drivers.zookeeper.KazooDriver.CHARACTERISTICS`

**Entrypoint name:** ``zookeeper`` or ``kazoo``

**Summary:**

The zookeeper is the reference implementation and provides the most solid
features as it's possible to build a cluster of zookeeper servers that is
resilient towards network partitions for example.

**Test driver:** :py:class:`tooz.drivers.zake.ZakeDriver`

**Characteristics:**

:py:attr:`tooz.drivers.zake.ZakeDriver.CHARACTERISTICS`

**Test driver entrypoint name:** ``zake``

Considerations
~~~~~~~~~~~~~~

- Primitives are based on sessions (and typically require careful selection
  of session heartbeat periodicity and server side configuration of session
  expiry).

Memcached
---------

**Driver:** :py:class:`tooz.drivers.memcached.MemcachedDriver`

**Characteristics:**

:py:attr:`tooz.drivers.memcached.MemcachedDriver.CHARACTERISTICS`

**Entrypoint name:** ``memcached``

**Summary:**

The memcached driver is a basic implementation and provides little
resiliency, though it's much simpler to setup. A lot of the features provided
in tooz are based on timeout (heartbeats, locks, etc) so are less resilient
than other backends.

Considerations
~~~~~~~~~~~~~~

- Less resilient than other backends such as zookeeper and redis.
- Primitives are often based on TTL(s) that may expire before
  being renewed.
- Lacks certain primitives (compare and delete) so certain functionality
  is fragile and/or broken due to this.

Redis
-----

**Driver:** :py:class:`tooz.drivers.redis.RedisDriver`

**Characteristics:**

:py:attr:`tooz.drivers.redis.RedisDriver.CHARACTERISTICS`

**Entrypoint name:** ``redis``

**Summary:**

The redis driver is a basic implementation and provides reasonable resiliency
when used with `redis-sentinel`_. A lot of the features provided in tooz are
based on timeout (heartbeats, locks, etc) so are less resilient than other
backends.

Considerations
~~~~~~~~~~~~~~

- Less resilient than other backends such as zookeeper.
- Primitives are often based on TTL(s) that may expire before
  being renewed.

IPC
---

**Driver:** :py:class:`tooz.drivers.ipc.IPCDriver`

**Characteristics:** :py:attr:`tooz.drivers.ipc.IPCDriver.CHARACTERISTICS`

**Entrypoint name:** ``ipc``

**Summary:**

The IPC driver is based on Posix IPC API and implements a lock
mechanism and some basic group primitives (with **huge**
limitations).

Considerations
~~~~~~~~~~~~~~

- The lock can **only** be distributed locally to a computer
  processes.

File
----

**Driver:** :py:class:`tooz.drivers.file.FileDriver`

**Characteristics:** :py:attr:`tooz.drivers.file.FileDriver.CHARACTERISTICS`

**Entrypoint name:** ``file``

**Summary:**

The file driver is a **simple** driver based on files and directories. It
implements a lock based on POSIX or Window file level locking
mechanism and some basic group primitives (with **huge**
limitations).

Considerations
~~~~~~~~~~~~~~

- The lock can **only** be distributed locally to a computer processes.
- Certain concepts provided by it are **not** crash tolerant.

PostgreSQL
----------

**Driver:** :py:class:`tooz.drivers.pgsql.PostgresDriver`

**Characteristics:**

:py:attr:`tooz.drivers.pgsql.PostgresDriver.CHARACTERISTICS`

**Entrypoint name:** ``postgresql``

**Summary:**

The postgresql driver is a driver providing only a distributed lock (for now)
and is based on the `PostgreSQL database server`_ and its API(s) that provide
for `advisory locks`_ to be created and used by applications. When a lock is
acquired it will release either when explicitly released or automatically when
the database session ends (for example if the program using the lock crashes).

Considerations
~~~~~~~~~~~~~~

- Lock that may be acquired restricted by
  ``max_locks_per_transaction * (max_connections + max_prepared_transactions)``
  upper bound (PostgreSQL server configuration settings).

MySQL
-----

**Driver:**  :py:class:`tooz.drivers.mysql.MySQLDriver`

**Characteristics:** :py:attr:`tooz.drivers.mysql.MySQLDriver.CHARACTERISTICS`

**Entrypoint name:** ``mysql``

**Summary:**

The MySQL driver is a driver providing only distributed locks (for now)
and is based on the `MySQL database server`_ supported `get_lock`_
primitives. When a lock is acquired it will release either when explicitly
released or automatically when the database session ends (for example if
the program using the lock crashes).

Considerations
~~~~~~~~~~~~~~

- Does **not** work correctly on some MySQL versions.
- Does **not** work when MySQL replicates from one server to another (locks
  are local to the server that they were created from).

Etcd
----

**Driver:**  :py:class:`tooz.drivers.etcd.EtcdDriver`

**Characteristics:** :py:attr:`tooz.drivers.etcd.EtcdDriver.CHARACTERISTICS`

**Entrypoint name:** ``etcd``

**Summary:**

The etcd driver is a driver providing only distributed locks (for now)
and is based on the `etcd server`_ supported key/value storage and
associated primitives.

Consul
------

**Driver:**  :py:class:`tooz.drivers.consul.ConsulDriver`

**Characteristics:**

:py:attr:`tooz.drivers.consul.ConsulDriver.CHARACTERISTICS`

**Entrypoint name:** ``consul``

**Summary:**

The `consul`_ driver is a driver providing only distributed locks (for now)
and is based on the consul server key/value storage and/or
primitives. When a lock is acquired it will release either when explicitly
released or automatically when the consul session ends (for example if
the program using the lock crashes).

Characteristics
---------------

.. autoclass:: tooz.coordination.Characteristics

.. _etcd server: https://coreos.com/etcd/
.. _consul: https://www.consul.io/
.. _advisory locks: http://www.postgresql.org/docs/8.2/interactive/\
                    explicit-locking.html#ADVISORY-LOCKS
.. _get_lock: http://dev.mysql.com/doc/refman/5.5/en/\
              miscellaneous-functions.html#function_get-lock
.. _PostgreSQL database server: http://postgresql.org
.. _MySQL database server: http://mysql.org
.. _redis-sentinel: http://redis.io/topics/sentinel