Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
old repo was full of junk. Here's a nice clean new repo. if there's interest in the project this will evolve into a full blown CPAN module, or I'll rewrite it into C and ... not put it on CPAN.
- Loading branch information
0 parents
commit 6472da3
Showing
6 changed files
with
744 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright (c) 2009, Dormando | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following disclaimer | ||
in the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
* Neither the name of the Danga Interactive nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Load balancer test cluster emulator | ||
Copyright 2009 Dormando (dormando@rydia.net) | ||
|
||
Pre-CPAN release of some quick test cluster software I wrote for a talk at | ||
Velocity 2009. | ||
|
||
Dependencies: | ||
|
||
Danga::Socket (though future releases might switch to AnyEvent) | ||
|
||
To start | ||
======== | ||
|
||
$ ./lbemu examples/ideal-test.yaml | ||
initialized "basic webserver" listener on 127.0.0.1:5000 | ||
initialized "basic webserver" listener on 127.0.0.1:5001 | ||
initialized "basic webserver" listener on 127.0.0.1:5002 | ||
initialized "basic webserver" listener on 127.0.0.1:5003 | ||
initialized "basic webserver" listener on 127.0.0.1:5004 | ||
initialized "basic webserver" listener on 127.0.0.1:5005 | ||
initialized "basic webserver" listener on 127.0.0.1:5006 | ||
initialized "basic webserver" listener on 127.0.0.1:5007 | ||
initialized "basic webserver" listener on 127.0.0.1:5008 | ||
initialized "basic webserver" listener on 127.0.0.1:5009 | ||
|
||
Look in examples/ directory for a few examples. | ||
|
||
HTTP parsing is _ultra_ simple. It supports an 'OPTIONS *' command, and a GET | ||
vs any configured URL's. No other processing is done. Responses consist of 'x' | ||
characters up to the requested response length. | ||
|
||
It's pretty fast. Disabling the scheduling algorithm I can get over 10,000 | ||
requests/sec on my laptop. With the algo it's a lot lower but still pretty | ||
good. A big point with this software is not to push a huge volume of requests | ||
through it, however. | ||
|
||
What lbemu is | ||
============= | ||
|
||
lbemu is a no-frills web cluster emulator. It allows you to create fake | ||
webservers listening on many IPs or ports, which you can then configure into | ||
your load balancer or proxy. It is useful in tuning paramters on your load | ||
balancer and for comparing effectiveness of different load balancers, if you | ||
are evaluating hardware/software solutions. | ||
|
||
Lbemu contains a fake even-balanced CPU scheduler in order to emulate how much | ||
*time* it takes to process a request. | ||
|
||
- Specify a machine as having 1-n CPU's (lets say four) | ||
- Specify each CPU as being able to process n 'ticks' per second (lets say | ||
5000) | ||
- lbemu runs at 50 'frames' per second. This is tunable in the top of your | ||
sourcecode if you frequently lag on a loop. | ||
- Requests are specified as having 0 or more ticks. a 0 tick doesn't enter the | ||
scheduler, it's immediately responded to. This is for requests like OPTIONS | ||
or a small static file. | ||
- lbemu attempts to have a request process in that amount of time, per | ||
scheduled across the CPUs. | ||
|
||
So if you have a request that takes 1000 ticks, with 4 cpus with a 5000 tick | ||
capacity each, a single request against the server should complete in roughly | ||
200 milliseconds. | ||
|
||
If you issue 4 requests all at once, they should all return in roughly 200 | ||
milliseconds. | ||
|
||
If you issue 8 requests all at once, they should all return in roughly 400 | ||
milliseconds. This is what sets lbemu aside as far as lightweight server | ||
emulation goes; it's not simply taking a request and returning a response | ||
after N amount of time. Based on the requests presently being processed, | ||
finished, running in parallel, requests will fluctuate and slow down at least | ||
somewhat similar to a real web cluster. | ||
|
||
You can also specify the equivalent of an apache MaxClients, which allows you | ||
to properly test perlbal or similar load balancer. | ||
|
||
If you think this stuff is useful, have a patch or idea, or want to say | ||
thanks or how much you hate me, feel free to shoot me an e-mail :) If there's | ||
interest, or if I continue to use the software, I'll continue to make | ||
releases. | ||
|
||
- Dormando (dormando@rydia.net) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Web cluster with nothing wrong with it | ||
requests: | ||
normal: | ||
name: "normal request" | ||
url: "/normal" | ||
ticks: 400 | ||
size: 5000 | ||
fast: | ||
name: "immediate response" | ||
url: "/fast" | ||
ticks: 0 | ||
size: 500 | ||
|
||
servers: | ||
basic: | ||
name: "basic webserver" | ||
cpu_count: 4 | ||
cpu_speed: 4000 | ||
max_conns: 8 | ||
listen_queue: 5 | ||
keep_alive: 1 | ||
|
||
clusters: | ||
main: | ||
name: "main cluster" | ||
port_start: 5000 | ||
ip: "127.0.0.1" | ||
total: 10 | ||
server_type: "basic" | ||
requests: | ||
- "normal" | ||
- "fast" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Cluster with one server who is swapping or otherwise impaired. | ||
requests: | ||
normal: | ||
name: "normal request" | ||
url: "/normal" | ||
ticks: 400 | ||
size: 5000 | ||
fast: | ||
name: "immediate response" | ||
url: "/fast" | ||
ticks: 0 | ||
size: 500 | ||
|
||
servers: | ||
basic: | ||
name: "basic webserver" | ||
cpu_count: 4 | ||
cpu_speed: 4000 | ||
max_conns: 8 | ||
listen_queue: 5 | ||
keep_alive: 1 | ||
swapper: | ||
name: "swapping webserver" | ||
cpu_count: 4 | ||
cpu_speed: 500 | ||
max_conns: 8 | ||
listen_queue: 5 | ||
keep_alive: 1 | ||
|
||
clusters: | ||
swap: | ||
name: "swap cluster" | ||
port_start: 5009 | ||
ip: "127.0.0.1" | ||
total: 1 | ||
server_type: "swapper" | ||
requests: | ||
- "normal" | ||
- "fast" | ||
main: | ||
name: "main cluster" | ||
port_start: 5000 | ||
ip: "127.0.0.1" | ||
total: 9 | ||
server_type: "basic" | ||
requests: | ||
- "normal" | ||
- "fast" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Cluster where half of the servers are old, and half are new. | ||
requests: | ||
normal: | ||
name: "normal request" | ||
url: "/normal" | ||
ticks: 400 | ||
size: 5000 | ||
fast: | ||
name: "immediate response" | ||
url: "/fast" | ||
ticks: 0 | ||
size: 500 | ||
|
||
servers: | ||
new: | ||
name: "new webserver" | ||
cpu_count: 4 | ||
cpu_speed: 4000 | ||
max_conns: 8 | ||
listen_queue: 5 | ||
keep_alive: 1 | ||
old: | ||
name: "old webserver" | ||
cpu_count: 4 | ||
cpu_speed: 2000 | ||
max_conns: 8 | ||
listen_queue: 5 | ||
keep_alive: 1 | ||
|
||
clusters: | ||
new: | ||
name: "new cluster" | ||
port_start: 5000 | ||
ip: "127.0.0.1" | ||
total: 5 | ||
server_type: "new" | ||
requests: | ||
- "normal" | ||
- "fast" | ||
old: | ||
name: "old cluster" | ||
port_start: 5005 | ||
ip: "127.0.0.1" | ||
total: 5 | ||
server_type: "old" | ||
requests: | ||
- "normal" | ||
- "fast" |
Oops, something went wrong.