-
Notifications
You must be signed in to change notification settings - Fork 22
Home
Bitsy is a small, fast, embeddable, durable in-memory graph database that implements Apache Tinkerpop.
- Support for Apache Tinkerpop aka Tinkerpop3
- ACID guarantees on transactions
- Designed for multi-threaded OLTP applications
- Implements optimistic concurrency control
- Data stored in readable text files
- Serialization using the Jackson JSON processor
- Recovers cleanly from power failures and crashes provided the underlying file system supports metadata journaling, like NTFS, ext3, ext4, XFS and JFS (not FAT32 or ext2)
- High read and write throughputs in multi-threaded environments
- Supports online backups through a JMX interface
You can add Bitsy and its dependencies to your project by adding this dependency:
<dependency>
<groupId>com.lambdazen.bitsy</groupId>
<artifactId>bitsy</artifactId>
<version>3.6.2</version>
</dependency>
The following code snippet shows how Bitsy can be launched and stopped:
import java.nio.file.Path;
import com.lambdazen.bitsy.BitsyGraph;
public class Test {
public static void main(String[] args) {
Path dbPath = Paths.get("...path to a directory...");
// Open the database
BitsyGraph myGraph = new BitsyGraph(dbPath);
... use myGraph in any number of threads
// Close the database
myGraph.shutdown();
}
}
You can use the BitsyAutoReloadingGraph instead of BitsyGraph for a more permissive Tinkerpop3 implementation that automatically reloads vertices and edges when accessed outside the scope of a transaction.
Note: The above example uses the simple constructor for BitsyGraph. Refer to Tuning Bitsy for other constructors, including a memory-only (non-durable) database constructor.
You can run Bitsy in embedded mode from your Gremlin Console as follows:
- Create a new
bitsy
folder under<console-dir>/ext
- Download the following JARs into the
ext/bitsy/plugin
folder:- https://repo1.maven.org/maven2/com/lambdazen/bitsy/bitsy/3.6.2/bitsy-3.6.2.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.13.1/jackson-core-2.13.1.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.13.1/jackson-annotations-2.13.1.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.13.1/jackson-databind-2.13.1.jar
- https://repo1.maven.org/maven2/com/nesscomputing/components/ness-core/1.9.1/ness-core-1.9.1.jar [DEPRECATED after version 3.4.1]
- Launch the Gremlin Console and run these commands:
import java.nio.file.Paths import com.lambdazen.bitsy.BitsyGraph graph = new BitsyGraph(Paths.get("<database path>")) g = graph.traversal()
Now you can use g
for Gremlin traversals and graph
for graph modification operations like addVertex
.
You can run Bitsy in the Gremlin Server as follows:
- Create a new
bitsy
folder under<server-dir>/ext
- Download the following JARs into the
ext/bitsy/plugin
folder:- https://repo1.maven.org/maven2/com/lambdazen/bitsy/bitsy/3.5.1/bitsy-3.5.1.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.10.3/jackson-core-2.10.3.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.3/jackson-annotations-2.10.3.jar
- https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.10.3/jackson-databind-2.10.3.jar
- https://repo1.maven.org/maven2/com/nesscomputing/components/ness-core/1.9.1/ness-core-1.9.1.jar [DEPRECATED after version 3.4.1]
- Download the two Gremlin server configuration files from https://github.com/lambdazen/bitsy/tree/master/src/test/resources/gremlin-server to the
<server-dir>/conf
directory - Edit the
bitsy.properties
file to point the correct database path - Launch Gremlin server with server configuration:
(Windows) bin\gremlin-server.bat conf\gremlin-server-bitsy.yaml (Unix) bin/gremlin-server.sh conf/gremlin-server-bitsy.yaml
Now you can launch the Gremlin Console (no changes necessary) and run
:remote connect tinkerpop.server conf/remote.yaml
to connect to the Gremlin server and execute commands on the graph
and g
objects.
This presentation provides an overview of Bitsy's original design principles and features. Improvements in version 1.5 are summarized in this presentation. Bitsy 3.x is now compatible with Tinkerpop v3.
The following Wiki pages go into a little more detail:
- Design Principles: No Seek, No Socket and No SQL
- Optimistic concurrency: Covers the concurrency control and best practices to retry transactions
- Write algorithms: Details the different write algorithms along with the threads, buffers and logs used
- Serialization format: Specifies the JSON format for the various records in the database files
- Benchmarks: Illustrates the read and write throughputs in a multi-threaded OLTP setting
- Tuning Bitsy: Covers the different BitsyGraph settings and how they can be changed
- Monitoring and Management: Covers JMX and SLF4J integration
- Backup and Restore: Discusses offline/online backup and restore procedures
- Large Objects: Handling large objects outside of Bitsy
- Fancy Indexes: Maintaining Lucene and Lucene-like indexes outside of Bitsy
Bitsy is available under the Apache 2.0 License.