Skip to content

Conversation

@kenhuuu
Copy link
Contributor

@kenhuuu kenhuuu commented Dec 2, 2025

The added destroySessionPostGraphOp setting enables re-using the same underlying connection for a different subsequent Session. This should increase performance for cases where many short-lived Transactions are sent to the server.

https://issues.apache.org/jira/browse/TINKERPOP-3217

VOTE +1

if (destroySessionPostGraphOp) {
// Destroy the session after a successful rollback due to error. Placed here rather than
// in a finally block since we don't want to end the session if no commit/rollback succeeded.
session.manualKill(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in a catch block that is catching all error types, is it possible for session.manualKill to be called twice if the previous call in the try block threw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't happen, but even if it does, theres explicit handling in that method for that situation so it's safe to call it more than once.

/**
* Integration tests for gremlin-driver and bytecode sessions.
*
* NOTE: this is effectively a copy of GremlinSessionTxIntegrateTest but the expectation is that the gremlin-driver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to actually verify the connection is reused or the connection state such that it can be reused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are server side metrics and/or logs that can be asserted against when a session is created/destroyed. This is a test that should be added but needs to wait on #3258

The added destroySessionPostGraphOp setting enables re-using the same
underlying connection for a different subsequent Session. This should
increase performance for cases where many short-lived Transactions are
sent to the server.
@Cole-Greer
Copy link
Contributor

VOTE +1

1 similar comment
@andreachild
Copy link
Contributor

VOTE +1

@andrii0lomakin
Copy link
Contributor

Thank you, @kenhuuu, nice feature. Will port to our version too.

@kenhuuu
Copy link
Contributor Author

kenhuuu commented Dec 16, 2025

Thank you, @kenhuuu, nice feature. Will port to our version too.

FYI, @andrii0lomakin there is no released Java driver/GLV that can take advantage of this. This will change in the next version of TinkerPop.

@kenhuuu kenhuuu merged commit 53959cc into 3.7-dev Dec 16, 2025
59 of 60 checks passed
@kenhuuu kenhuuu deleted the TINKERPOP-3217 branch December 16, 2025 21:39
@andrii0lomakin
Copy link
Contributor

@kenhuuu we use our own fork, so we can use it already now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants