Skip to content

Commit

Permalink
web site and benchmark fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Dahl committed Feb 27, 2008
1 parent 7897e7c commit 0e2dc88
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 45 deletions.
69 changes: 42 additions & 27 deletions README
@@ -1,10 +1,9 @@
Ebb Web Server
# A Web Server Called *Ebb*

= Design
## Design

The design is similar to the Evented Mongrel web server; except instead of
using EventMachine (a ruby binding to libevent), the Ebb web server is written
in C and uses the libev event loop library (http://software.schmorp.de/pkg/libev.html).
The design is similar to the [Evented Mongrel][1] web server; except instead
of using EventMachine (a ruby binding to libevent), the Ebb web server is written in C and uses the [libev][2] event loop library.

Connections are processed as follows:

Expand All @@ -27,31 +26,47 @@ make it useful to Non-Ruby frameworks. For example, a Python WSGI interface is
forthcoming.

Ebb aims to be the smallest and fastest web server possible specifically for
doing the processing for web frameworks like Rails.
doing the processing for web frameworks like Rails, Merb, and Django.

= TODO
* Option to listen on unix sockets instead of tcp
## Why?

Why? Because by building the server in C one is able to side-step the limitations on speed of many scripting languages. Inefficiencies are okay for quick and beautiful code, but for production web servers that might handle thousands of requests a second, an attempt should be made to be as efficient as possible.

![Response Size](http://s3.amazonaws.com/four.livejournal/20080227/response_size.png)

![Concurrency](http://s3.amazonaws.com/four.livejournal/20080227/concurrency.png)

![Uploads](http://s3.amazonaws.com/four.livejournal/20080227/post_size.png)

## Download


## TODO
* Option to listen on unix sockets instead of TCP
* Python binding

= License
## License

Copyright (c) 2007 Ryan Dahl

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[1]: http://swiftiply.swiftcore.org/mongrel.html
[2]: http://software.schmorp.de/pkg/libev.html
25 changes: 24 additions & 1 deletion Rakefile
Expand Up @@ -24,6 +24,29 @@ task(:test => :compile) do
sh "ruby #{dir("benchmark/test.rb")}"
end


task(:generate_site => 'site/index.html')
file('site/index.html' => %w{README site/style.css}) do
require 'BlueCloth'

doc = BlueCloth.new(File.read(dir('README')))
template = <<-HEREDOC
<html>
<head>
<title>Ebb</title>
<link type="text/css" rel="stylesheet" href="style.css" media="screen"/>
</head>
<body>
<div id="content">CONTENT</div>
</body>
</html>
HEREDOC

File.open(dir('site/index.html'), "w+") do |f|
f.write template.sub('CONTENT', doc.to_html)
end
end

spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "A Web Server"
Expand Down Expand Up @@ -55,5 +78,5 @@ Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
end

CLEAN.add ["**/*.{o,bundle,so,obj,pdb,lib,def,exp}", "benchmark/*.dump"]
CLEAN.add ["**/*.{o,bundle,so,obj,pdb,lib,def,exp}", "benchmark/*.dump", 'site/index.html']
CLOBBER.add ['src/Makefile', 'src/parser.c', 'src/mkmf.log','doc', 'coverage']
23 changes: 17 additions & 6 deletions benchmark/digest.rb → benchmark/bench_results.rb
@@ -1,6 +1,6 @@
# supply the benchmark dump file as an argumetn to this program
require 'rubygems'
require 'google_response_chart'
require 'google_chart'
require 'server_test'

class Array
Expand All @@ -12,23 +12,34 @@ def sum
end
end



colors = %w{F74343 444130 7DA478 E4AC3D}
max_x = 0
max_y = 0
results = ServerTestResults.open(ARGV[0])
all_m = []
response_chart = GoogleChart::LineChart.new('400x300', Time.now.strftime('%Y.%m.%d'), true)
results.servers.each do |server|
data = results.data(server, :size).sort
data = results.data(server).sort
response_chart.data(server, data, colors.shift)
# data.delete_if { |d| d[0] > 100.kilobytes }
x = data.map { |d| d[0] }.max
y = data.map { |d| d[1] }.max
x = data.map { |d| d[0] }.max
y = data.map { |d| d[1] }.max
max_x = x if x > max_x
max_y = y if y > max_y
end

label = case results.benchmark
when "response_size"
"kilobytes served"
when "wait_fib", "concurrency"
"concurrency"
when "post_size"
"kilobytes uploaded"
end

response_chart.axis(:y, :range => [0,max_y])
response_chart.axis(:y, :labels => ['req/s'], :positions => [50])
response_chart.axis(:x, :range => [0,max_x])
response_chart.axis(:x, :labels => ['bytes served'], :positions => [50])
response_chart.axis(:x, :labels => [label], :positions => [50])
puts response_chart.to_url
4 changes: 2 additions & 2 deletions benchmark/server_bench
Expand Up @@ -21,7 +21,7 @@ trials = {
'wait_fib' => [1,20,40,60,80,100].map { |c|
[c, "ab -t 3 -q -c #{c} http://0.0.0.0:PORT/periodical_activity/fibonacci/20}"]
},
'post_size' => [0.1,1,5,7,10,15,18,20,23,25,30,40,45,50].map { |l|
'post_size' => [0.1,1,5,7,10,15,18,20,23,25,30,35,37,40,45,50].map { |l|
size = (l * 1024).to_i
fn = "/tmp/ebb_post_trial_#{size}"
File.open(fn, 'w+') { |f| f.write("C"*size) } unless FileTest.exists?(fn)
Expand Down Expand Up @@ -63,4 +63,4 @@ ensure
puts "\n\nkilling servers"
servers.each { |server| server.kill }
results.write(dumpfile)
end
end
10 changes: 3 additions & 7 deletions benchmark/server_test.rb
Expand Up @@ -73,7 +73,6 @@ class ServerTest
def initialize(name, port, &start_block)
@name = name
@port = port
@start_block = start_block
end

def <=>(a)
Expand All @@ -99,8 +98,6 @@ def start
@pid = fork { start_mongrel }
when 'thin'
@pid = fork { start_thin }
else
@pid = fork { @start_block.call }
end
end

Expand All @@ -112,13 +109,12 @@ def start_emongrel
require 'mongrel'
require 'swiftcore/evented_mongrel'
ENV['EVENT'] = "1"
Rack::Handler::Mongrel.run(app, :Port => @port)
Rack::Handler::Mongrel.run(app, :Host => '0.0.0.0', :Port => @port)
end

def start_ebb
require File.dirname(__FILE__) + '/../ruby_lib/ebb'
server = Ebb::Server.new(app, :port => @port)
server.start
server = Ebb::Server.run(app, :port => @port)
end

def start_mongrel
Expand Down
4 changes: 2 additions & 2 deletions benchmark/test.rb
Expand Up @@ -95,7 +95,7 @@ def test_ab
end

def test_large_post
response = post("/test_post_length", 'C'*1024*15)
response = post("/test_post_length", 'C'*1024*50)
assert_equal 200, response.code.to_i, response.body
end

Expand Down Expand Up @@ -136,4 +136,4 @@ def test_ebb_rails_version
#
# assert !File.exists?(filename)
# end
# end
# end
30 changes: 30 additions & 0 deletions site/style.css
@@ -0,0 +1,30 @@
/* #E4AC3D pride of the leo (orange)
* #CBCFB6 sandy field (light gray)
* #7DA478 neverending garden (green)
* #444130 lost independance (brown)
* #F74343 Groovy Baby (red)
*/
body {
background: #FFF;
color: #444130;
font-family: Arial;
line-height: 15pt;
font-size: 11pt;
margin: 0;
}

h1, h2, h3, h4 { color: #CBCFB6; }

a { color: #E4AC3D; }
blockquote { font-size: 80%; }

#content {
margin: 1em auto ;
max-width: 30em;
}

#content p {
}
#about {
list-style:none;
}

0 comments on commit 0e2dc88

Please sign in to comment.