1.Web server
Unicorn
Unicorn is designed for fast-running requests.
Single-threaded, multi-process。
All processes listen on a single shared socket, this simplifies reverse proxy configuration
Good stability.
Thin
Allows high concurrency.
Uses the evented I/O model by utilizing the EventMachine library.
Need to monitor crashes etc.
High customization, but it is difficult to design efficient clusters.
Rainbows: based on unicorn, for sleepy apps and slow clients
Puma
Built For Concurrency.
Can change Single-process mode to Multi-process. Single-process, multi-threaded, use Thread Pool.
According to the number of requests to adjust the number of threads between min and max.
Use less resource of RAM when the number of request is small.
Allowing blocking IO to be run concurrentl.
To make best use of multi-CUP, change MRI to JRuby or Rubinius.
Not very good stability.
Passenger(Raptor)
Most Simple config.(Passeger's goal is to make everything Just Work(tm) with as little hassle as possible.)
Integrates directly into Apache or Nginx.
Not easy to customize,advanced features need to pay.
References:
2.Sidekiq
Simple, efficient background processing for Ruby. In some cases like delivering many emails in one task.
Sidekiq build a page for managing background processes.
Both Resque and Sidekiq are Redis-backed.
Resque forks a new process for every job, Sidekiq uses multithreading.
Use Resque to makes a queue of jobs in Radis then let Sidekiq process them in some particular situations like creating a user firstly and then upload a avatar.
3.Zeus
Speed up rails command execution.
4.Rails vs Sinatra
-
Rails
- Pros
- Rails is a integration for web development.
- Database access, ActiveRecord.
- Template engine, Erb.
- Test framwork
- Many open-source and high-quality gems.
- Use Rails can build a porject very fastly.
- Rails is a integration for web development.
- Pros
-
Cons
- ActiveRecord: Easy to use, but bad design like 1 + N query.
- Performance: Rails applications are not as fast as Java or C.
- Scaling: it's not easy to optimize and refactor when the project becomes large.
-
Sintra
-
Pros
- Easy to learn.(Simple wrapper for Rack)
- Focus on HTTP.
- Good performance compare to Rails.
- Easy to work with ruby gems, easy to customize for small web porject.
-
Cons
Need to draw up a standard for development of Sintra.
-
Need to do many work for efficient development.
- Srcipts doing some work like
rails new
- Building development, test and production evrionments
- Connnecting database.
- Loging.
- Some thing like
rails console
- Deploy
- Maintain
- Srcipts doing some work like
Hand-over, need readable and overall documents.
-
How do we make decision on which framework to use?
It depends on requirements.
-
Rails:
- When we need launch a poject as far as possible for test our new ideas or the feedback from users.
-
Sinatra:
- Help fresher to learn what file structure and components a web server need, for understanding deeply how Rails works.
- When a poject needn't do every things a normal web app will, like API server, use Sinatra with good design of project structure and proper gems can make a better performance than Rails.