Partition AwarenessΒΆ

Partition awareness allows the thin client to send query requests directly to the node that owns the queried data.

Without partition awareness, an application that is connected to the cluster via a thin client executes all queries and operations via a single server node that acts as a proxy for the incoming requests. These operations are then re-routed to the node that stores the data that is being requested. This results in a bottleneck that could prevent the application from scaling linearly.

Without partition awareness

Notice how queries must pass through the proxy server node, where they are routed to the correct node.

With partition awareness in place, the thin client can directly route queries and operations to the primary nodes that own the data required for the queries. This eliminates the bottleneck, allowing the application to scale more easily.

With partition awareness

Partition awareness can be enabled or disabled by setting partition_aware parameter in pyignite.client.Client.__init__() or pyignite.aio_client.AioClient.__init__() to True (by default) or False.

Also, it is recommended to pass list of address and port pairs of all server nodes to pyignite.client.Client.connect() or to pyignite.aio_client.AioClient.connect().

For example:

from pyignite import Client

client = Client(
    partition_awareness=True
)
nodes = [('10.128.0.1', 10800), ('10.128.0.2', 10800),...]
with client.connect(nodes):
    ....
from pyignite import AioClient

client = AioClient(
    partition_awareness=True
)
nodes = [('10.128.0.1', 10800), ('10.128.0.2', 10800),...]
async with client.connect(nodes):
    ....