Repository navigation
Closed
Description
ArcadeDB Version:
ArcadeDB Server version: 23.11.1
OS and JDK Version:
OS = Linux(ubuntu 22.04)
JDK version = 17
Artifacts:
arcadedb-gremlin = 23.12.1-SNAPSHOT
arcadedb-network = 23.12.1-SNAPSHOT
Expected behavior
Simple mutation logics within a transaction block, such as adding new vertex with ~3 properties should not take more than ~20ms in a database with existing record size of 1000 records.
Actual behavior
The simple mutation logic is taking 300ms.
Steps to reproduce
There are two implementation styles which will help to compare the performance issue.
- The mutation logic ran as below without explicitly starting transaction at client side.
This implementation will commit transaction at server side.
Performance: 10ms. This is an expected performance.
Drawback: Unable to perform client side transaction management. In case of rollback due to client side exceptions, with this implementation is not possible.
ArcadeGraph arcadeGraph = arcadeGraphFactory.get();
GraphTraversalSource g = arcadeGraph.traversal();
try {
g.addV("Country").property("id", id).property("country", country).property("code", code).iterate();
} catch (Exception e) {
logger.debug("Exception: {}", e);
} finally {
arcadeGraph.close();
}
- The mutation logic ran as below by starting transaction using arcadeGraph.tx().begin() and commit at client side:
ArcadeGraph arcadeGraph = arcadeGraphFactory.get();
GraphTraversalSource g = arcadeGraph.tx().begin();
try {
g.addV("Country").property("id", id).property("country", country).property("code", code).iterate();
arcadeGraph.tx().commit();
} catch (Exception e) {
arcadeGraph.tx().rollback();
} finally {
arcadeGraph.close();
}
Performance: 300ms. This is an issue.
But here full control of transaction is possible.
To summarize, the expectation is to have the latency of mutation logic to be at ~10-20ms, together with the ability to control transaction management at client side.
Activity
lvca commentedon Dec 18, 2023
I've created 2 new tests in our test suite:
And the version that begin/commit a transaction per vertex, 1,000 times, it's a little slower than the one that executes 1,000 adds a vertex in the same transaction:
How can I reproduce this issue? Could your issue be related to the client/server network?
Could you please get the latest source and run the tests above under the class
com.arcadedb.server.gremlin.RemoteGremlinFactoryIT?test: addes a couple of tests for issue #1390
devcode100 commentedon Dec 18, 2023
One of the key difference between the above Tests and the implementation I shared is that I use ArcadeGraphFactory as singleton and create ArcadeGraph instance for every request. The requests are concurrent and may not be always sequential.
lvca commentedon Dec 18, 2023
I tested by getting a new graph every time, but since we have a pool now, the performance are identical to the previous tests. Trying to spin multiple threads
lvca commentedon Dec 18, 2023
Tried multi threads, same time:
I think it could be the latency between client and server. How are they connected? LAN? Internet?
devcode100 commentedon Dec 18, 2023
Am using the same connection and setup for both the scenarios(10ms and 300ms code blocks run on same setup)and at this moment I can rule out bandwidth dependency.
If you can follow the below *Steps to Replicate:
Spin up new cloud VM(I use AWS EC2 - Ubuntu 22.04) specifically test on cloud VM and connect to it remotely from client. at least this is how I could replicate ]
bin/server.sh -Darcadedb.server.plugins="GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin"
Enabled logs. PF the trace for the mutation logic which took > ~300ms.

I tried to replicate in local[windows](follow step 3-7), am not getting the issue, Tx is fast.
If you are not able to replicate even after following the above steps(similar) then I will wait for the next release to upgrade the server and maven libs without any manual artifact build and replacement, and will test it again.
Note:-
If the complete tx() is sum of below 3 network round trips, then its fair to have the latency as I mentioned and could be considered as working as expected. The ping latency is fairly high for the cloud VM's I use.
lvca commentedon Dec 18, 2023
I found the reason. With the TX management, ArcadeDB is using the HTTP protocol and it's sending 3 HTTP commands for each cycle to the server:
With the non-TX management (the fast one), the client communicates with the Gremlin server by using the binary protocol + the transaction management is done on the server side.
So the difference in speed is mainly for the 3 requests against 1. The 3 requests cannot be sent asynchronously because they are sequential begin/addV/commit. You pay the latency here of waiting for the 2 additional commands.
About the HTTP vs Binary protocols, I don't think this makes a lot of difference.
lvca commentedon Dec 19, 2023
Tried back with using only Gremlin, but this is the exception on the Gremlin side:
And this was the source:
So I'm closing the issue, knowing that by using explicit TX control means involving 2 commands per vertex
test: changes the tests for #1390
chore(deps): bump neo4j-driver from 6.0.1 to 6.1.0 in /e2e-js [skip ci]
test: addes a couple of tests for issue ArcadeData#1390
test: changes the tests for ArcadeData#1390
chore(deps): bump neo4j-driver from 6.0.1 to 6.1.0 in /e2e-js [skip ci]
chore(deps-dev): bump testcontainers from 12.0.4 to 12.1.0 in /e2e-js…
chore(deps-dev): bump testcontainers from 12.0.4 to 12.1.0 in /e2e-st…