1DBIx::Class::Storage::DUBsIe:r:RCeoDpnBltIirxci:ab:tuCetldea:ds:sBP:ae:lrSaltnocDreoarcg(ue3m:)e:nDtBaIt:i:oRneplicated::Balancer(3)
2
3
4

NAME

6       DBIx::Class::Storage::DBI::Replicated::Balancer - A Software Load
7       Balancer
8

SYNOPSIS

10       This role is used internally by DBIx::Class::Storage::DBI::Replicated.
11

DESCRIPTION

13       Given a pool (DBIx::Class::Storage::DBI::Replicated::Pool) of
14       replicated database's
15       (DBIx::Class::Storage::DBI::Replicated::Replicant), defines a method by
16       which query load can be spread out across each replicant in the pool.
17

ATTRIBUTES

19       This class defines the following attributes.
20
21   auto_validate_every ($seconds)
22       If auto_validate has some sort of value, run "validate_replicants" in
23       DBIx::Class::Storage::DBI::Replicated::Pool every $seconds.  Be careful
24       with this, because if you set it to 0 you will end up validating every
25       query.
26
27   master
28       The DBIx::Class::Storage::DBI object that is the master database all
29       the replicants are trying to follow.  The balancer needs to know it
30       since it's the ultimate fallback.
31
32   pool
33       The DBIx::Class::Storage::DBI::Replicated::Pool object that we are
34       trying to balance.
35
36   current_replicant
37       Replicant storages (slaves) handle all read only traffic.  The
38       assumption is that your database will become readbound well before it
39       becomes write bound and that being able to spread your read only
40       traffic around to multiple databases is going to help you to scale
41       traffic.
42
43       This attribute returns the next slave to handle a read request.  Your
44       "pool" attribute has methods to help you shuffle through all the
45       available replicants via its balancer object.
46

METHODS

48       This class defines the following methods.
49
50   _build_current_replicant
51       Lazy builder for the "current_replicant" attribute.
52
53   next_storage
54       This method should be defined in the class which consumes this role.
55
56       Given a pool object, return the next replicant that will serve queries.
57       The default behavior is to grab the first replicant it finds but you
58       can write your own subclasses of
59       DBIx::Class::Storage::DBI::Replicated::Balancer to support other
60       balance systems.
61
62       This returns from the pool of active replicants.  If there are no
63       active replicants, then you should have it return the master as an
64       ultimate fallback.
65
66   around: next_storage
67       Advice on next storage to add the autovalidation.  We have this broken
68       out so that it's easier to break out the auto validation into a role.
69
70       This also returns the master in the case that none of the replicants
71       are active or just forgot to create them :)
72
73   increment_storage
74       Rolls the Storage to whatever is next in the queue, as defined by the
75       Balancer.
76
77   around: select
78       Advice on the select attribute.  Each time we use a replicant we need
79       to change it via the storage pool algorithm.  That way we are spreading
80       the load evenly (hopefully) across existing capacity.
81
82   around: select_single
83       Advice on the select_single attribute.  Each time we use a replicant we
84       need to change it via the storage pool algorithm.  That way we are
85       spreading the load evenly (hopefully) across existing capacity.
86
87   before: columns_info_for
88       Advice on the current_replicant_storage attribute.  Each time we use a
89       replicant we need to change it via the storage pool algorithm.  That
90       way we are spreading the load evenly (hopefully) across existing
91       capacity.
92
93   _get_forced_pool ($name)
94       Given an identifier, find the most correct storage object to handle the
95       query.
96

FURTHER QUESTIONS?

98       Check the list of additional DBIC resources.
99
101       This module is free software copyright by the DBIx::Class (DBIC)
102       authors. You can redistribute it and/or modify it under the same terms
103       as the DBIx::Class library.
104
105
106
107perl v5.32.1                DBIx::2C0l2a1s-s0:1:-S2t7orage::DBI::Replicated::Balancer(3)
Impressum