-
-
Notifications
You must be signed in to change notification settings - Fork 876
Open
Milestone
Description
OrientDB Version: 2.2.32
Java Version: 1.8.0_181
OS: Ubuntu 16.04
Expected behavior
I hope to improve parallel query perfomance.
Actual behavior
I ran a query in one thread when got the results, it cost about 500ms. But in multi-threaded, when I ran the same query in 5 threads at the same time, when got the resutls, all theads cost 2300ms ~ 2600ms; when the number of theads increased to 10, all threads cost 4500ms ~ 5100ms.
Is there some mistakes in my use of OrientDB, or is there some settings can improve parallel query perfomance?
Steps to reproduce
here is my code:
public class TestParallelQuery {
public static void main(String[] args) {
try {
OServerAdmin serverAdmin = new OServerAdmin("remote:localhost").connect("root", "root");
if (!serverAdmin.existsDatabase("metadata", "plocal")) {
serverAdmin.createDatabase("metadata", "graph", "plocal");
}
serverAdmin.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
OrientGraphFactory factory= new OrientGraphFactory("remote:localhost/metadata", "root", "root");
factory.setAutoStartTx(false);
factory.setupPool(5, 50);;
int threadCount = 5;
for (int i = 0; i < threadCount; i++) {
new Thread(() -> {
long start = System.currentTimeMillis();
OrientGraph orientGraph = factory.getTx();
String sql = "select * from mytable skip 0 limit 100";
Iterable<Vertex> vertices = orientGraph.command(new OCommandSQL(sql.toString())).execute();
System.out.println(Thread.currentThread().getName() + "===" + "execute sql cost:" + (System.currentTimeMillis() - start));
}).start();;
}
}
}
Metadata
Metadata
Assignees
Labels
No labels