How to improve transaction performance? #3673
Replies: 1 comment
-
Although it is a nuisance if your framework does not do things optimally, it is just reality that we have to do workarounds sometimes. Note that without explicit transactions, individual client requests are already wrapped inside a transaction by Gremlin Server. Locking is not a likely cause, unless you explicitly specified uniqueness constraints in the schema, see: https://docs.janusgraph.org/advanced-topics/eventual-consistency/#data-consistency Apparently, other resources of Gremlin Server are blocked for longer than before (memory, script executors, connection pools, etc.), so it might be worthwhile to check these. |
Beta Was this translation helpful? Give feedback.
-
We have some operations that are executed one by by one. Example:
await licenseHelper.AcquireLicense(....); // performs some inserts/updates in graph
await contnetHelper.AddContent(...); // performs some inserts/updates in graph
We need to run these commands in one transaction. The reason is if the second command will fail. the first one should be rollbacked.
We run it in paralell for 200 operations and avg execution time is ~3sec.
We added transactions:
this.remoteTransaction = this.graph.Tx();
var graphSource = this.remoteTransaction.Begin();
try {
await licenseHelper.AcquireLicense(...., graphSource ); // performs some inserts/updates in graph with graphSource
await contnetHelper.AddContent(..., graphSource ); // performs some inserts/updates in graph with graphSource
await this.remoteTransaction.CommitAsync(cancellationToken);
}
catch (Exception) {
await this.remoteTransaction.RollbackAsync();
}
As a result the avg execution time degradated for 200 ops to 45-60sec.
We suppose there is some locking mechanism involved in transaction. Are there any way to decrease the consistency level?
We tried to set storage.cql.use-external-locking=true, but id didn't have affect.
We use Janusgraph 0.6.2, .Net, JanusGraph lib 0.4.3. CQL.
Beta Was this translation helpful? Give feedback.
All reactions