问题
I have been reading posts about OrientDB performance benchmarks: http://technet.weblineindia.com/web/introduction-to-orientdb-a-nosql-dbms/ is one example.
It suggests "It can store upto 150,000 records per second on common hardware"
I might be doing something wrong, but i haven't been able to achieve this performance trying to UPSERT in orientDB:
- Java API (check if a vertex is present, if not - create one) - Processed data in around 5 minutes for 20k records
- ETL did process insert very quickly - 19k records in 20 seconds - but ETL doesn't support UPSERT
- using batches of OCommandScript the best was achieved with HASH INDEX - 3.40 minutes - 21k records - SBTREE 2.46 minutes - 21k records - HASH INDEX 3 minutes - 5k records - LUCENCE FULLTEXT INDEX
- USING a HTTP POST - & JSON 5 minutes for 21k records
What am i missing please? Is there a better way to upsert that I am not aware of ?
To create/update Vertex my code is as below : for (String key : keySet) {
iterator = graph.getVertices(keyName, key).iterator();
if (iterator.hasNext()) {
vertex = (OrientVertex) iterator.next();
} else {
vertex = graph.addVertex(className, attributeName, key);
count++;
}
vertexMap.put(key, vertex);
if ((count != 0) && (count % batch == 0)) {
System.out
.println("ModelDataUtils:: createVertexes:: Committing and re-opening the transaction");
graph.commit();
}
}
To add an edge(if doesn't exist) the code is as below:
if (!parentCardVertex
.getEdges(cardVertex, Direction.OUT)
.iterator().hasNext()) {
parentCardVertex.addEdge("Composedof",
cardVertex);
}
All classes have the UNIQUE_HASH_INDEX on the "Name" attribute. Also, I analysed, edge creation is taking significantly more time than vertex creation.
来源:https://stackoverflow.com/questions/33801952/orientdb-performance