Search code examples
gremlin-serverjanusgraph

VertexIDs of vertex can collide or not, when you put several Janusserver


I have a question. I would like to know if vertex IDs of vertex can collide or not, when you put several Janusserver inserting vertices against the same Cassandra? enter image description here


Solution

  • VertexIDs are unique across cluster

    JanusGraph IDs are 64 bit long

    [ 0 | count | partition | ID padding (if any) ]
    
    • ID padding : Based on the type of element
    • Partition : Each janusgraph node uniquely allocate IDBlock for some (default 10) partition.
    • Count : provide a local count from each IDBlock

    Together with the count, partition and id padding the is ID unique across cluster


    JanusGraph Bit Format

    JanusGraph uses ConsistentKeyIDAuthority class to allocate IDBlock. IDBlock Consist of start count and block size (Default Value 10000). For each partition in a JanusGraph instance it locally increment count, starting from start count and assign maximum block size number of id.

    A JanusGraph Instance have default 10 partition. These partition and IDBlock are initialized at startup, If a IDBlock id creating size exceeds the block size then it reallocate new IDBlock. If a partition's start count exceeds the max counter value, then it added to the exhausted partition.

    JanusGraph uses cassandra janusgraph_ids table to allocate IDBlock.

    Note : All the term partition, IDBlock are JanusGraph specific