View on
MetaCPAN
search.cpan.org is shutting down
For details read Perl NOC. After June 25th this page will redirect to MetaCPAN.org
小塚昌隆 > FarmBalance-0.03 > FarmBalance

Download:
FarmBalance-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

FarmBalance - make nice balance in Farming System regarding data, traffics, etc..

SYNOPSIS ^

  #- use OLTP to determine new user's farm 
  use FarmBalance;
  my $farms = 4;      #- write farm number of systems
  my $stats = {       #- give system stats.
        'a_table_rows' => [1000, 700, 629, 800],
        'b_table_rows' => [300, 70, 26, 200],
        'server_tps'   => [1000, 300, 5, 200],
  };
  my $input = {       #- give new commer's data and traffic, estimated. 
                      #- if undefined, filled by average values of stats.
        'a_table_rows' => 20,
        'b_table_rows' => 33,
        'server_tps' => 10,
  };
  my $df = FarmBalance->new(
        farms => $farms,
        stats => $stats,
        input => $input,
  );
  $df->report($df->{stats});    #- report before adding new user
  $df->define_farm;
  print "DefineNode:" , $df->{effective_farm} , "\n"; #- best farm to insert.
  $df->report($df->{stats});    #- report after adding user.

 
  #- when use in data migration.
  use FarmBalance;
  my $farms = 4;
  my $src = 'migration.tsv'; #- like "uid100\t20\t22\t5..."
  my $stats = {       #- give new system stats.
        'a_table_rows' => [0, 0, 0, 0],
        'b_table_rows' => [0, 0, 0, 0],
        'server_tps'   => [0, 0, 0, 0],
  };
  my $df = FarmBalance->new(
        farms => $farms,
        stats => $stats,
  );
  open (IN, $file );
  while ( <IN> ) {
        chomp;
        my ( $row, $keyA, $keyB, $keyC ) = split (/\t/, $_);
        my $input = +{
                'a_table_rows' => $keyA,
                'b_table_rows' => $keyB,
                'server_tps' => $keyC,
        };
        $df->{input} = $input;
        $df->define_farm;
        print "Row: $row => DefineNode:" , $df->{effective_farm} , "\n";
        #- Insert data to above node.
  }
  close(IN);

DESCRIPTION ^

FarmBalance is useful tool to reduce variability in Web Farming System. In many web sites, engineers uses many application-servers and database-servers to handle too much transacions and too may data. Deciding farm to insert new user and new data, often Hashing logic or residual calculation is used. But it often results in variability of data rows in DB and server traffic.

Using FarmBalance and giving it Server Stats ( ex. data rows, transactions, server resources from system infromations), your farming system will be in nice balance.

FarmBalance calculates effect to reduce standard deviation, supposing new user added to each nodes in estimated values. And, chose most effective farm.

AUTHOR ^

DUKKIE(Masataka Koduka) <dukkie@cpan.org>

with helps from H.Fujimiya, K.Moriyama and Y.Kanda.

SEE ALSO ^

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: