Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 80 lines (56 sloc) 2.885 kb
3cc1e1e @gdb Initial import of Einhorn
gdb authored
1 # Einhorn: the language-independent shared socket manager
2
3 ![Einhorn](https://stripe.com/img/blog/posts/meet-einhorn/einhorn.png)
4
5 Let's say you have a server process which processes one request at a
6 time. Your site is becoming increasingly popular, and this one process
7 is no longer able to handle all of your inbound connections. However,
8 you notice that your box's load number is low.
9
10 So you start thinking about how to handle more requests. You could
11 rewrite your server to use threads, but threads are a pain to program
12 against (and maybe you're writing in Python or Ruby where you don't
13 have true threads anyway). You could rewrite your server to be
14 event-driven, but that'd require a ton of effort, and it wouldn't help
15 you go beyond one core. So instead, you decide to just run multiple
16 copies of your server process.
17
18 Enter Einhorn. Einhorn makes it easy to run (and keep alive) multiple
19 copies of a single long-lived process. If that process is a server
20 listening on some socket, Einhorn will open the socket in the master
21 process so that it's shared among the workers.
22
23 Einhorn is designed to be compatible with arbitrary languages and
24 frameworks, requiring minimal modification of your
25 application. Einhorn is simple to configure and run.
26
27 ## Installation
28
29 Install from Rubygems as:
30
31 $ gem install einhorn
32
33 Or build from source by:
34
35 $ gem build einhorn.gemspec
36
37 And then install the built gem.
38
39 [[usage]]
40
41 ## Contributing
42
43 Contributions are definitely welcome. To contribute, just follow the
44 usual workflow:
45
46 1. Fork Einhorn
47 2. Create your feature branch (`git checkout -b my-new-feature`)
48 3. Commit your changes (`git commit -am 'Added some feature'`)
49 4. Push to the branch (`git push origin my-new-feature`)
50 5. Create new Github pull request
51
52 ## History
53
54 Einhorn came about when Stripe was investigating seamless code
55 upgrading solutions for our API worker processes. We really liked the
56 process model of [Unicorn](http://unicorn.bogomips.org/), but didn't
57 want to use its HTTP functionality. So Einhorn was born, providing the
58 master process functionality of Unicorn (and similar preforking
59 servers) to a wider array of applications.
60
61 See https://stripe.com/blog/meet-einhorn for more background.
62
63 Stripe currently uses Einhorn in production for a number of
64 services. Our Thin + EventMachine servers currently require patches to
65 both Thin and EventMachine (to support file-descriptor passing). You
66 can obtain these patches from our public forks of the
67 [respective](https://github.com/stripe/thin)
68 [projects](https://github.com/stripe/eventmachine). Check out
69 `example/thin_example` for an example of running Thin under Einhorn.
70
71 ## Compatibility
72
73 Einhorn was developed and tested under Ruby 1.8.7.
74
75 ## About
76
77 Einhorn is a project of [Stripe](https://stripe.com), led by [Greg
78 Brockman](https://twitter.com/thegdb). Feel free to get in touch at
79 info@stripe.com.
Something went wrong with that request. Please try again.