GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::CLASS::STORAGE::DBI::REPLICATED::BALANCER (3)

.ds Aq ’

NAME

DBIx::Class::Storage::DBI::Replicated::Balancer - A Software Load Balancer

CONTENTS

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 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 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.

FURTHER QUESTIONS?

Check the list of additional DBIC resources.

COPYRIGHT AND LICENSE

This module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::CLASS::STORAGE::DBI::REPLICATED::BALANCER (3) 2016-02-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.