v5:reference:loadbalancer:enable_sticky_sessionsl
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| v5:reference:loadbalancer:enable_sticky_sessionsl [2017/04/23 19:49] – created mnewnham | v5:reference:loadbalancer:enable_sticky_sessionsl [2017/05/11 01:14] (current) – [Description] mnewnham | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| <WRAP right box> | <WRAP right box> | ||
| == Applies To == | == Applies To == | ||
| - | ADOdb Load Balancer | + | [[v5: |
| == See Also == | == See Also == | ||
| [[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> | ||
| - | $response = $db->removeConnection(2); | + | $db->enable_sticky_sessions = false; |
| </ | </ | ||
v5/reference/loadbalancer/enable_sticky_sessionsl.1492969781.txt.gz · Last modified: by mnewnham
