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

METHODS

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

AUTHOR

97       John Napiorkowski <jjnapiork@cpan.org>
98

LICENSE

100       You may distribute this code under the same terms as Perl itself.
101
102
103
104perl v5.12.0                DBIx::2C0l1a0s-s0:5:-S1t2orage::DBI::Replicated::Balancer(3)
Impressum