Using the Driver

Connecting to a Cluster

To take advantage of the higher level features of the driver, Goblin provides the Cluster object. Cluster is used to create multi-host clients that leverage connection pooling and sharing. Its interface is based on the TinkerPop Java driver:

>>> cluster = await  # opens a cluster with default config
>>> client = await cluster.connect()
>>> resp = await client.submit(gremlin='1 + 1')  # round robin requests to available hosts
>>> async for msg in resp:
...     print(msg)
>>> await cluster.close()  # Close all connections to all hosts

And that is it. While Cluster is simple to learn and use, it provides a wide variety of configuration options.

Configuring Cluster

Configuration options can be set on Cluster in one of two ways, either passed as keyword arguments to open, or stored in a configuration file and passed to the open using the kwarg configfile. Configuration files can be either YAML or JSON format. Currently, Cluster uses the following configuration:

For information related to improving driver performance, please refer to the performance section.