v5:reference:loadbalancer:enable_sticky_sessionsl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:reference:loadbalancer:enable_sticky_sessionsl [2017/04/25 01:07] – mnewnham | v5:reference:loadbalancer:enable_sticky_sessionsl [2017/05/11 01:14] (current) – [Description] mnewnham | ||
---|---|---|---|
Line 7: | Line 7: | ||
[[v5: | [[v5: | ||
== Syntax == | == Syntax == | ||
- | bool $enable_sticky_sessions | + | bool $enable_sticky_sessions=true |
</ | </ | ||
===== Description ===== | ===== Description ===== | ||
- | The public class variable '' | + | The public class variable '' |
+ | The normal behavior of the load balancer is to re-use the first found connection, as the overhead of establishing a database connection is generally larger than that of running multiple simple queries against a single connection. | ||
+ | The primary use-case for disabling this is if you are running a substantial number of heavy queries and want to truly load balance at the per-query level rather than the per-request level. | ||
+ | |||
+ | Since connecting to the database can take longer than running a few queries, it is less efficient to startup 5 connections to run 5 separate queries, when all 5 queries could be run on a single connection in less time. However if you need to run 1000 queries in a row (ie: batch job), it might be better to startup 5 connections and load balance all 1000 queries across those connections. | ||
--------------------------- | --------------------------- | ||
===== Usage ===== | ===== Usage ===== | ||
<code php> | <code php> | ||
- | $db-> | + | $db-> |
</ | </ |
v5/reference/loadbalancer/enable_sticky_sessionsl.1493075222.txt.gz · Last modified: 2017/04/25 01:07 by mnewnham