Skip to content
This repository
Newer
Older
100644 95 lines (61 sloc) 6.748 kb
4e083e97 »
2011-01-01 update README; make markdown
1 # Goliath
2
d0bd5c72 »
2011-03-03 update readme: faq, performance
3 Goliath is an open source version of the non-blocking (asynchronous) Ruby web server framework powering PostRank. It is a lightweight framework designed to meet the following goals: bare metal performance, Rack API and middleware support, simple configuration, fully asynchronous processing, and readable and maintainable code (read: no callbacks).
5b62186a »
2011-02-26 update readme to match index page content
4
d0bd5c72 »
2011-03-03 update readme: faq, performance
5 The framework is powered by an EventMachine reactor, a high-performance HTTP parser and Ruby 1.9 runtime. The one major advantage Goliath has over other asynchronous frameworks is the fact that by leveraging Ruby fibers introduced in Ruby 1.9+, it can untangle the complicated callback-based code into a format we are all familiar and comfortable with: linear execution, which leads to more maintainable and readable code.
5b62186a »
2011-02-26 update readme to match index page content
6
d0bd5c72 »
2011-03-03 update readme: faq, performance
7 Each HTTP request within Goliath is executed in its own Ruby fiber and all asynchronous I/O operations can transparently suspend and later resume the processing without requiring the developer to write any additional code. Both request processing and response processing can be done in fully asynchronous fashion: streaming uploads, firehose API's, request/response, and so on.
4e083e97 »
2011-01-01 update README; make markdown
8
79017463 »
2011-02-15 update readme
9 ## Installation & Prerequisites
4e083e97 »
2011-01-01 update README; make markdown
10
d0bd5c72 »
2011-03-03 update readme: faq, performance
11 * Install Ruby 1.9 (via RVM or natively)
12
13 $> gem install rvm
14 $> rvm install 1.9.2
15 $> rvm use 1.9.2
16
17 * Install Goliath:
18
19 $> gem install goliath
4e083e97 »
2011-01-01 update README; make markdown
20
79017463 »
2011-02-15 update readme
21 ## Getting Started: Hello World
4e083e97 »
2011-01-01 update README; make markdown
22
5ff1e0ce »
2011-07-24 add links to peepcode screencasts on EM & Goliath
23 ```ruby
24 require 'goliath'
25
26 class Hello < Goliath::API
27 def response(env)
28 [200, {}, "Hello World"]
29 end
30 end
4e083e97 »
2011-01-01 update README; make markdown
31
5ff1e0ce »
2011-07-24 add links to peepcode screencasts on EM & Goliath
32 > ruby hello.rb -sv
33 > [97570:INFO] 2011-02-15 00:33:51 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
34 ```
4e083e97 »
2011-01-01 update README; make markdown
35
5ff1e0ce »
2011-07-24 add links to peepcode screencasts on EM & Goliath
36 See examples directory for more, hands-on examples of building Goliath powered web-services. Are you new to EventMachine, or want a detailed walk-through of building a Goliath powered API? You're in luck, we have two super-awesome peepcode screencasts which will teach you all you need to know:
4e083e97 »
2011-01-01 update README; make markdown
37
5ff1e0ce »
2011-07-24 add links to peepcode screencasts on EM & Goliath
38 * [Meet EventMachine: Part 1](http://peepcode.com/products/eventmachine) - introduction to EM, Fibers, etc.
39 * [Meet EventMachine: Part 2](http://peepcode.com/products/eventmachine-ii) - building an API with Goliath
5ec844c3 »
2011-02-26 update readme to reflect async request processing support
40
d0bd5c72 »
2011-03-03 update readme: faq, performance
41 ## Performance: MRI, JRuby, Rubinius
42
43 Goliath is not tied to a single Ruby runtime - it is able to run on MRI Ruby, JRuby and Rubinius today. Depending on which platform you are working with, you will see different performance characteristics. At the moment, we recommend MRI Ruby 1.9.2 as the best performing VM: a roundtrip through the full Goliath stack on MRI 1.9.2p136 takes ~0.33ms (~3000 req/s).
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
44
d0bd5c72 »
2011-03-03 update readme: faq, performance
45 JRuby performance (with 1.9 mode enabled) is currently much worse than MRI Ruby 1.9.2, due to the fact that all JRuby fibers are mapped to native Java threads. However, there is [very promising](http://classparser.blogspot.com/2010/04/jruby-coroutines-really-fast.html), existing work that promises to make JRuby fibers even faster than those of MRI Ruby. Once this functionality is built into JRuby ([JRUBY-5461](http://jira.codehaus.org/browse/JRUBY-5461)), JRuby may well take the performance crown. At the moment, without the MLVM support, a request through the full Goliath stack takes ~6ms (166 req/s).
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
46
d0bd5c72 »
2011-03-03 update readme: faq, performance
47 Rubinius + Goliath performance is tough to pin down - there is a lot of room for optimization within the Rubinius VM. Currently, requests can take as little as 0.2ms and later spike to 50ms+. Stay tuned!
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
48
d0bd5c72 »
2011-03-03 update readme: faq, performance
49 Goliath has been in production at PostRank for over a year, serving a sustained 500 requests/s for internal and external applications. Many of the Goliath processes have been running for months at a time (read: no memory leaks) and have served hundreds of gigabytes of data without restarts. To scale up and provide failover and redundancy, our individual Goliath servers at PostRank are usually deployed behind a reverse proxy (such as HAProxy).
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
50
d0bd5c72 »
2011-03-03 update readme: faq, performance
51 ## FAQ
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
52
d0bd5c72 »
2011-03-03 update readme: faq, performance
53 * How does Goliath compare to other Ruby async app-servers like Thin?
54 * They are similar (both use Eventmachine reactor), but also very different. Goliath is able to run on different Ruby platforms (see above), uses a different HTTP parser, supports HTTP keepalive & pipelining, and offers a fully asynchronous API for both request and response processing.
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
55
d0bd5c72 »
2011-03-03 update readme: faq, performance
56 * How does Goliath compare to Mongrel, Passenger, Unicorn?
57 * Mongrel is a threaded web-server, and both Passenger and Unicorn fork an entire VM to isolate each request from each other. By contrast, Goliath builds a single instance of the Rack app and runs all requests in parallel through a single VM, which leads to a much smaller memory footprint and less overhead.
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
58
d0bd5c72 »
2011-03-03 update readme: faq, performance
59 * How do I deploy Goliath in production?
def9123e »
2011-09-29 link to sample haproxy config in readme
60 * We recommend deploying Goliath behind a reverse proxy such as HAProxy ([sample config](https://github.com/postrank-labs/goliath/wiki/HAProxy)), Nginx or equivalent. Using one of the above, you can easily run multiple instances of the same application and load balance between them within the reverse proxy.
5593a9d1 »
2011-02-19 Updated the README to cover the basics of the built-in server.
61
79017463 »
2011-02-15 update readme
62 ## Guides
4e083e97 »
2011-01-01 update README; make markdown
63
d0bd5c72 »
2011-03-03 update readme: faq, performance
64 * [Server Options](https://github.com/postrank-labs/goliath/wiki/Server)
474379f3 »
2011-02-15 links in readme
65 * [Middleware](https://github.com/postrank-labs/goliath/wiki/Middleware)
66 * [Configuration](https://github.com/postrank-labs/goliath/wiki/Configuration)
67 * [Plugins](https://github.com/postrank-labs/goliath/wiki/Plugins)
68
d0bd5c72 »
2011-03-03 update readme: faq, performance
69 ### Hands-on applications:
eda9fb24 »
2011-02-15 fix spacing
70
d34493bd »
2011-07-28 Fixed typo.
71 * [Peepcode](http://peepcode.com/products/eventmachine) [screencasts](http://peepcode.com/products/eventmachine-ii)
474379f3 »
2011-02-15 links in readme
72 * [Asynchronous HTTP, MySQL, etc](https://github.com/postrank-labs/goliath/wiki/Asynchronous-Processing)
d0bd5c72 »
2011-03-03 update readme: faq, performance
73 * [Response streaming with Goliath](https://github.com/postrank-labs/goliath/wiki/Streaming)
474379f3 »
2011-02-15 links in readme
74 * [Examples](https://github.com/postrank-labs/goliath/tree/master/examples)
4e083e97 »
2011-01-01 update README; make markdown
75
273cb235 »
2011-03-08 add coverage links to readme
76 ## Coverage
77
78 * [Goliath: Non-blocking, Ruby 1.9 Web Server](http://www.igvita.com/2011/03/08/goliath-non-blocking-ruby-19-web-server)
79 * [Stage left: Enter Goliath - HTTP Proxy + MongoDB](http://everburning.com/news/stage-left-enter-goliath/)
15f81aef »
2011-03-26 Added InfoQ to "Coverage" on README.md
80 * [InfoQ: Meet the Goliath of Ruby Application Servers](http://www.infoq.com/articles/meet-goliath)
201e29ae »
2011-03-26 more coverage links in readme
81 * [Node.jsはコールバック・スパゲティを招くか](http://el.jibun.atmarkit.co.jp/rails/2011/03/nodejs-d123.html)
ca07f869 »
2011-04-18 Add some links in coverage
82 * [Goliath on LinuxFr.org (french)](http://linuxfr.org/news/en-vrac-spécial-ruby-jruby-sinatra-et-goliath)
83 * [Goliath et ses amis (slides in french)](http://nono.github.com/Presentations/20110416_Goliath/)
273cb235 »
2011-03-08 add coverage links to readme
84
79017463 »
2011-02-15 update readme
85 ## Discussion and Support
4e083e97 »
2011-01-01 update README; make markdown
86
79017463 »
2011-02-15 update readme
87 * [Source](https://github.com/postrank-labs/goliath)
88 * [Issues](https://github.com/postrank-labs/goliath/issues)
2815bba4 »
2011-02-10 add mailing list
89 * [Mailing List](http://groups.google.com/group/goliath-io)
4e083e97 »
2011-01-01 update README; make markdown
90
e51f1196 »
2011-02-15 linewrap
91 ## License & Acknowledgments
92
de8da801 »
2011-04-07 remove reloader from readme example
93 Goliath is distributed under the MIT license, for full details please see the LICENSE file.
63953707 »
2011-07-30 Added a favicon interceptor to the examples, and used it in the raste…
94 Rock favicon CC-BY from [Douglas Feer](http://www.favicon.cc/?action=icon&file_id=375421)
Something went wrong with that request. Please try again.