-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Clusters | ||
-------- | ||
|
||
Python-arango provides support for ArangoDB clusters. For more information on | ||
clusters, refer to `ArangoDB manual`_. | ||
|
||
.. _ArangoDB manual: https://docs.arangodb.com | ||
|
||
Coordinators | ||
============ | ||
|
||
To connect to multiple ArangoDB hosts (e.g. coordinators) you must provide | ||
either a list of host strings or a comma-separated string during client | ||
initialization. | ||
|
||
**Example:** | ||
|
||
.. testcode:: | ||
|
||
from arango import ArangoClient | ||
|
||
# Single instance | ||
client = ArangoClient(hosts='http://localhost:8529') | ||
|
||
# Multiple instances (option 1: list) | ||
client = ArangoClient(hosts=['http://host1:8529', 'http://host2:8529']) | ||
|
||
# Multiple instances (option 2: comma-separated string) | ||
client = ArangoClient(hosts='http://host1:8529,http://host2:8529') | ||
|
||
Load-Balancing | ||
============== | ||
|
||
There are two load-balancing strategies available: "roundrobin" and "random" | ||
(defaults to "roundrobin" if not specified). | ||
|
||
**Example:** | ||
|
||
.. testcode:: | ||
|
||
from arango import ArangoClient | ||
|
||
hosts = ['http://host1:8529', 'http://host2:8529'] | ||
|
||
# Round-robin | ||
client = ArangoClient(hosts=hosts, host_resolver='roundrobin') | ||
|
||
# Random | ||
client = ArangoClient(hosts=hosts, host_resolver='random') | ||
|
||
See :ref:`ArangoClient` for API specification. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ Contents | |
errors | ||
logging | ||
http | ||
cluster | ||
serializer | ||
contributing | ||
specs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
Threading | ||
--------- | ||
Multithreading | ||
-------------- | ||
|
||
There are a few things you should consider before using python-arango in a | ||
multithreaded (or multiprocess) architecture. | ||
|
||
Stateful Objects | ||
================ | ||
|
||
Instances of the following classes are considered *stateful*, and should not be | ||
shared across multiple threads without locks in place: | ||
accessed across multiple threads without locks in place: | ||
|
||
* :ref:`BatchDatabase` (see :doc:`batch`) | ||
* :ref:`BatchJob` (see :doc:`batch`) | ||
* :ref:`Cursor` (see :doc:`cursor`) | ||
|
||
The rest of python-arango is safe to use in multi-threaded environments. | ||
|
||
HTTP Sessions | ||
============= | ||
|
||
When :ref:`ArangoClient` is initialized, a `requests.Session`_ instance is | ||
created per ArangoDB host connected. HTTP requests to a host are sent using | ||
only its corresponding session. For more information on how to override this | ||
behaviour, see :doc:`http`. | ||
|
||
Note that a `requests.Session`_ object may not always be thread-safe. Always | ||
research your use case! | ||
|
||
.. _requests.Session: http://docs.python-requests.org/en/master/user/advanced/#session-objects |