From 95330ed5d8581d4fb524cef6b5043f54a6312ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Bary=C5=82a?= Date: Tue, 23 Jan 2024 18:04:46 +0100 Subject: [PATCH] Docs: Add warning about wrong Session usage --- docs/source/connecting/connecting.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/connecting/connecting.md b/docs/source/connecting/connecting.md index 2c60e32f7e..7a1f07ec0a 100644 --- a/docs/source/connecting/connecting.md +++ b/docs/source/connecting/connecting.md @@ -37,6 +37,10 @@ other nodes in this cluster and connect to them as well. ## Best practices for using Session +:::{warning} +Always try to use only a single Session object per apllication because creating them is very expensive! +::: + The driver maintains its own pool of connections to each node and each connection is capable of handling multiple requests in parallel. Driver will also route requests to nodes / shards that actually own the data (unless the load balancing policy that you use doesn't support it). For those reasons, we recommend using one instance of `Session` per application.