CrapServer
Really thin and non intuitive ruby server. Made to be fast and ready for really heavy servers (not only http server). Use Preforking, Evented IO and a Thread Pool to handle each connection and prevent get stuck by some slow query.
Another one?
Yes. Why? because 2 main reasons. First, this is not a HTTP Web server, this is a generic server that can be used for any kind of TCP Socket server. Second and most important, because is funny :)
Installation
Add this line to your application's Gemfile:
gem 'crap_server'
And then execute:
$ bundle
Or install it yourself as:
$ gem install crap_server
Basic Usage
CrapServer::Application.run! do |data|
if data =~ /^GET/
write "Hello world"
elsif data =~ /^SET/
write "Setting value"
else
write "Something is wrong"
end
end
See all available options in lib/crap_server/configure.rb
Pool size
By default, the pool size run 10 threads per core. You can change it with the pool_size config option.
Running our application
ruby my_app.rb
More info.
More info in the wiki of the gem.
Production ready?
No. Use it under your own risk. Right now, the interface can change.
Contributing
- Fork it ( https://github.com/anga/crap_server/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request