You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For all Read & Write requests made in this session,
127
138
// node to access is calculated from the unique string & the seed defined on the store
128
-
var employee = session.Load<Employee>("employees/1-A");
139
+
var employee1 = session.Load<Employee>("employees/1-A");
140
+
141
+
var employee2 = session.Load<Employee>("employees/3-A");
129
142
\}
130
143
`}
131
144
</CodeBlock>
@@ -250,15 +263,13 @@ using (documentStore)
250
263
251
264
## When to use
252
265
253
-
*Distributing _Read & Write_ requests among the cluster nodes can be beneficial
254
-
when a set of sessions handle a specific set of documents or similar data.
255
-
Load balancing can be achieved by routing requests from the sessions that handle similar topics to the same node, while routing other sessions to other nodes.
266
+
*When a session handles a specific set of documents or data, that can be scoped under a shared context.
267
+
Setting the context can greatly reduce chances for conflicts. It can be useful, when used with the [optimistic concurrency](../../../client-api/session/configuration/how-to-enable-optimistic-concurrency/),
268
+
to ensure that requests for the same data are routed to the same node.
256
269
257
-
* Another usage example can be setting the session's context to be the current user.
258
-
Thus spreading the _Read & Write_ requests per user that logs into the application.
270
+
* When a user or a tenant owns their data and can benefit from having them served from one node. Also, in regards to the conflicts and the optimistic concurrency checks mentioned above.
259
271
260
-
* Once setting the load balance to be per session-context,
261
-
in the case when detecting that many or all sessions send requests to the same node,
272
+
* Once setting the load balance to be per session-context, in the case when detecting that many or all sessions send requests to the same node,
262
273
a further level of node randomization can be added by changing the seed.
0 commit comments