About rails application server

Long time no see. This is Ide. It's been a year since the last article.

The Advent calendar that came this year too! Yesterday, Danny, who loves young Hope Daniel Barenboim, wrote an article. The article is here

He is a cool guy who entered halfway through, I've come to touch the server all the time and it's promising in the future!

It is a retrospective article after joining the company If you are interested in Prakore, I hope you will feel the atmosphere!

With Danny's flow, I would like to look back on this year as well.

Until last year, my main language was PHP, but from this year I have been developing systems mainly for Ruby. The description method is unique and it was a pain at first, but looking back, it is a very fun language. There are still some parts that I haven't understood yet, so next year I'll move on to gain a deeper understanding!

Such a server application famous for Rails which is FW of ruby About puma / unicorn, the other day or yesterday I had a chance to look up the command I will summarize it together with the differences in functions.

About unicorn

Assumption: unicorn is multi-process/single thread.

Unicorn handles communication for each process. Therefore, if there is a slow io process, it will get stuck and the whole will be heavy. You need to increase the number of orkers to avoid this, The worker also depends on the number of CPU cores.

command

Start-up

bundle exec unicorn -E production -c config/unicorn.rb -D

-E Execution environment variable -c location of configuration file -D daemonization

Stop

kill -QUIT cat pid file path
kill -QUIT master pid

Reboot

kill -HUP cat pid file path
kill -HUP master pid

Slow reboot

kill -USR2 cat pid file path
kill -USR2 master pid

Start a new process while keeping the old process After starting, execute a stop signal (QUIT) to stop the old process.

(Specifications are https://github.com/phusion/unicorn reference)

About puma

Assumption: puma is multi-process/multi-threaded.

It became a standard function from rails 5.2. It enables parallel processing by accumulating request processing in thread units and executing it in multiples. It is possible to handle requests efficiently even when resources are scarce.

command

Start-up

bundle exec puma -C config/puma.rb -d

-C Location of configuration file -d daemonization

Stop

kill -QUIT cat pid file path
kill -QUIT master pid

Reboot (no configuration file reload)

kill -USR1 cat pid file path
kill -USR1 master pid

Reboot (with configuration file reload)

kill -USR2 cat pid file path
kill -USR2 master pid

It would be nice if it could be used properly depending on the intended use. Unless it's a large system, it doesn't seem to affect performance. The article here summarizes the performance parts of both.

Tomorrow, Mr. Yoshi, a promising stock at the front desk, will write an article, so stay tuned! See you in a week! : raised_hand:

Now hiringļ¼ At Prakore, to create a free future We are looking for engineers and designers who want to adventure together! https://www.wantedly.com/projects/262436 Operation service PLACOLE DRESSY by Plakore farny by Plakore

Recommended Posts

About rails application server
About Rails 6
Rails web server and application server
[Rails] About ActiveJob ,!
About Rails controller
About RSpec (Rails)
[Rails] About migration files
[Rails 6] About main gems
[Rails] About active hash
About rails kaminari pagination
About rails version specification
MEMO about Rails 6 series
Try deploying Rails application to EC2-Part 2 (Server construction)-
[Rails] About Slim notation
[Rails] Create an application
[rails] About devise defaults
Rails: About partial templates
About rails strong parameters
[Beginner] About Rails Session
Rails server doesn't start.
Implement application function in Rails
Java (WebSphere Application Server) memo [1]
rails new application launch command
about the where method (rails)
[Ruby on Rails] about has_secure_password
About naming Rails model methods
[Rails] About scss folder structure
How to terminate rails server
[Rails] About Rspec response test
About Rails scraping method Mechanize
About regular execution of rake task of rails application on heroku
Preparing to create a Rails application
[Rails] About the Punk List function
Introducing full calendar to Rails application
About the symbol <%%> in Rails erb
[Rails] About implementation of like function
About creating an application with springboot
[Rails] I tried deleting the application
Chewing Rails Tutorial [Chapter 2 Toy Application]
[Rails] About helper method form_with [Basic]
About =
Connect to Rails server with iPhone
Consideration about Rails and Clean Architecture
About Docker, disguise server and container
About the problem that the server can not be started with rails s
Visualize Rails server processing time using Server Timing
Introduce two-factor authentication to your Rails application
[Ruby on Rails] About bundler (for beginners)
[Rails 6.0] About batch saving of multiple records
Rails API server environment construction using docker-compose
[Ruby on Rails] About Active Record callbacks
Ruby on Rails application new creation command
[Rails] About local: true described in form_with
Rails Basics of creating a new application
Rails: A little summary about data types
Rails server cannot be started in Cloud9
Build Web Application Server (Java) on VPS
About the case where "Docker" freeter tried to put Docker in the existing Rails application