I am using Tinkerpop Blueprints to create a OrientDB graph for a dataset 
with millions of nodes and 100M edges on a laptop with 16gb memory, 64-bit 
Ubuntu, 64-bit jvm. 


Here are the results from our benchmarking – the vertices get added fine 
but each edge addition takes almost a second.



<https://lh3.googleusercontent.com/-7hCsS_Ky8lk/WMc7aYtsE3I/AAAAAAAAADg/TioxDNNklfgEsUJ_0aGnnJO1ZuCsnYBMACLcB/s1600/Screenshot%2Bfrom%2B2017-03-10%2B12-37-07.png>




























Can you suggest what we are not doing right wrt to the edge creation and 
how we can get it to improve to a more reasonable latency?



Here's the code associated with the above table:





package orientdbtest

import com.orientechnologies.orient.core.metadata.schema.OType
import com.tinkerpop.blueprints.{Direction, Edge, Vertex}
import com.tinkerpop.blueprints.impls.orient._
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert

object Example {
  
  def addRandomVertex(graph: OrientGraphNoTx, uuid: String) : Vertex = graph
.addVertex("class:Random", "uuid", uuid)
    
  def addRandomEdge(source: Vertex, target: Vertex, id: String) = graph.
addEdge(null, source, target, id)
  def createRandomNetworkDatabase(graph: OrientGraphNoTx, numNodes: Int, 
numEdges: Int, useLightWeightEdges: Boolean):(Long, Long) = {   
    
    if (graph.getVertexType("Random") == null) {
        println("Creating random type")
        val random_vertex_type: OrientVertexType = graph.createVertexType(
"Random")
        random_vertex_type.createProperty("id", OType.STRING)
      } else {
        println("Random type exists")
      }

    val timeStartNodeCreation = System.currentTimeMillis()
    
    val nodeList: List[Vertex] = Range(0,numNodes).toList.map(x => 
addRandomVertex(graph, x.toString()))
    
    val timeEndNodeCreation = System.currentTimeMillis()
    
    println("Time to create " + numNodes + " is " + (timeEndNodeCreation-
timeStartNodeCreation)) 

    val nodeListFirstHalf = nodeList.slice(0,nodeList.length/2)
    val nodeListSecondHalf = nodeList.slice(nodeList.length/2+1,nodeList.
length)
    
    var edgeID = 1
    if(useLightWeightEdges) graph.setUseLightweightEdges(true)
    val timeStartEdgeCreation = System.currentTimeMillis()
    // createEdges from first half to the second half

    nodeListFirstHalf.foreach(sourceVertex => {
       nodeListSecondHalf.foreach(targetVertex => {
         while(edgeID < numEdges)
         {
             addRandomEdge(sourceVertex, targetVertex, edgeID.toString())
             edgeID = edgeID +1
             graph.commit()
         }
         })
    })
    
    val timeEndEdgeCreation = System.currentTimeMillis()
    println("Time to create " + edgeID + " is " + (timeEndEdgeCreation-
timeStartEdgeCreation)) 
    (0L, 0L)
  }
  
  def main(args: Array[String]): Unit = {

    val numNodes = 10
    val numEdges = 25
    val useLightWeightEdges = false

    val uri: String = "plocal:target/database/random_sample_" + numNodes + 
"_" + numEdges + useLightWeightEdges.toString()
    val graph: OrientGraphNoTx = new OrientGraphNoTx(uri) 

    graph.setKeepInMemoryReferences(false);
    graph.getRawGraph().getLocalCache().setEnable(false)
    graph.declareIntent(new OIntentMassiveInsert())
    try {
      createRandomNetworkDatabase(graph, numNodes, numEdges, 
useLightWeightEdges)
      graph.declareIntent(null)
    } finally {
      graph.shutdown()
    }
    println("Adios")
  }
}



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to