Tomyhill
Tomyhill

Reputation: 79

Should every instance of application have their own cassandra session or they should share the same session?

I have a cluster setup of 3 nodes.

I am designing my microservice and I am wondering if each node should have their own Cassandra session or if all three should share the same session created by any of the nodes.

I have read in the Cassandra docs:

"The Session instance is a long-lived object and it should not be used in a request/response short-lived fashion. Basically you will want to share the same cluster and session instances across your application."

What does this mean?

Upvotes: 1

Views: 104

Answers (1)

Alex Tbk
Alex Tbk

Reputation: 2104

You share your session on application level. Different applications should have own sessions.

Your quote means that you dont open a session for a query but rather have a singleton Session instance in your application.

Upvotes: 1

Related Questions