Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dbix::class::storage::dbi::replicated::balancer(3) [osx man page]

DBIx::Class::Storage::DBI::Replicated::Balancer(3)	User Contributed Perl Documentation	DBIx::Class::Storage::DBI::Replicated::Balancer(3)

NAME
DBIx::Class::Storage::DBI::Replicated::Balancer - A Software Load Balancer SYNOPSIS
This role is used internally by DBIx::Class::Storage::DBI::Replicated. DESCRIPTION
Given a pool (DBIx::Class::Storage::DBI::Replicated::Pool) of replicated database's (DBIx::Class::Storage::DBI::Replicated::Replicant), defines a method by which query load can be spread out across each replicant in the pool. ATTRIBUTES
This class defines the following attributes. auto_validate_every ($seconds) If auto_validate has some sort of value, run "validate_replicants" in DBIx::Class::Storage::DBI::Replicated::Pool every $seconds. Be careful with this, because if you set it to 0 you will end up validating every query. master The DBIx::Class::Storage::DBI object that is the master database all the replicants are trying to follow. The balancer needs to know it since it's the ultimate fallback. pool The DBIx::Class::Storage::DBI::Replicated::Pool object that we are trying to balance. current_replicant Replicant storages (slaves) handle all read only traffic. The assumption is that your database will become readbound well before it becomes write bound and that being able to spread your read only traffic around to multiple databases is going to help you to scale traffic. This attribute returns the next slave to handle a read request. Your "pool" attribute has methods to help you shuffle through all the available replicants via its balancer object. METHODS
This class defines the following methods. _build_current_replicant Lazy builder for the "current_replicant_storage" attribute. next_storage This method should be defined in the class which consumes this role. Given a pool object, return the next replicant that will serve queries. The default behavior is to grab the first replicant it finds but you can write your own subclasses of DBIx::Class::Storage::DBI::Replicated::Balancer to support other balance systems. This returns from the pool of active replicants. If there are no active replicants, then you should have it return the master as an ultimate fallback. around: next_storage Advice on next storage to add the autovalidation. We have this broken out so that it's easier to break out the auto validation into a role. This also returns the master in the case that none of the replicants are active or just just forgot to create them :) increment_storage Rolls the Storage to whatever is next in the queue, as defined by the Balancer. around: select Advice on the select attribute. Each time we use a replicant we need to change it via the storage pool algorithm. That way we are spreading the load evenly (hopefully) across existing capacity. around: select_single Advice on the select_single attribute. Each time we use a replicant we need to change it via the storage pool algorithm. That way we are spreading the load evenly (hopefully) across existing capacity. before: columns_info_for Advice on the current_replicant_storage attribute. Each time we use a replicant we need to change it via the storage pool algorithm. That way we are spreading the load evenly (hopefully) across existing capacity. _get_forced_pool ($name) Given an identifier, find the most correct storage object to handle the query. AUTHOR
John Napiorkowski <jjnapiork@cpan.org> LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.16.2 2012-08-16 DBIx::Class::Storage::DBI::Replicated::Balancer(3)

Check Out this Related Man Page

DBIx::Class::Storage::DBI::Replicated::Balancer::Random(User Contributed Perl DocumentatDBIx::Class::Storage::DBI::Replicated::Balancer::Random(3)

NAME
DBIx::Class::Storage::DBI::Replicated::Balancer::Random - A 'random' Balancer SYNOPSIS
This class is used internally by DBIx::Class::Storage::DBI::Replicated. You shouldn't need to create instances of this class. DESCRIPTION
Given a pool (DBIx::Class::Storage::DBI::Replicated::Pool) of replicated database's (DBIx::Class::Storage::DBI::Replicated::Replicant), defines a method by which query load can be spread out across each replicant in the pool. This Balancer uses List::Util keyword 'shuffle' to randomly pick an active replicant from the associated pool. This may or may not be random enough for you, patches welcome. ATTRIBUTES
This class defines the following attributes. master_read_weight A number greater than 0 that specifies what weight to give the master when choosing which backend to execute a read query on. A value of 0, which is the default, does no reads from master, while a value of 1 gives it the same priority as any single replicant. For example: if you have 2 replicants, and a "master_read_weight" of 0.5, the chance of reading from master will be "20%". You can set it to a value higher than 1, making master have higher weight than any single replicant, if for example you have a very powerful master. METHODS
This class defines the following methods. next_storage Returns an active replicant at random. Please note that due to the nature of the word 'random' this means it's possible for a particular active replicant to be requested several times in a row. AUTHOR
John Napiorkowski <john.napiorkowski@takkle.com> LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.16.2 2011-05-23 DBIx::Class::Storage::DBI::Replicated::Balancer::Random(3)
Man Page