[RUBY] What is the difference between a web server and an application server?

I wondered, "What is the difference between a web server and an application server?"

What is a server?

First of all, what is a server? The story. The server is a server in English, that is, it supplies and provides. According to the IT Glossary, a server is another computer network. A computer that provides its own functions, services, data, etc. to a computer. When we browse a web page, we ask the server "I want to see this page!" From our PC. Then the server returns a page saying "Yes, this!". Now you can see the happy web page. Normally, each server machine or server software has a fixed function or service to be provided to the outside, and a supported data format or protocol (communication protocol). Then, it is called "○○ server" with the types of functions to be provided, such as "DB server", "web server", and "application server".

web server

The role of the web server is to receive content requests from the browser and return a response to the browser. If the request at this time is static web content (content that displays the same display content unless updated, such as HTML, CSS, and image files), the web server processes it and returns a response. In the case of dynamic web content that requires processing to change the display content for each client, the web server sends a request to the application server. Then, the result returned from the application server is returned as a response. Well-known web servers include Nginx and Apache.

Application server

The application server runs the applications we create. The request sent from the web server is transmitted from the application server to the application, and the result processed by the application is returned to the web server. In the case of development in a local environment, only the application server is set up, but in the production environment, by placing the web server in front of the application, it is often the case that the processing of static content is burdened.

For example Rails

Typical Rails application servers are Unicorn, Thin, Rainbows, Puma, etc. The request sent from the web server is transmitted from the application server to the Rails application, and the result processed by the Rails application is returned to the web server. When developing in a local environment, set up only an application server for Rails such as Puma (the one that is usually done in the development environment). On the other hand, in the production environment, the web server is often placed in front of the Rails application to bear the burden of static content processing. This allows the web server to process multiple applications at once, render assets quickly, and handle many of the things that happen with each request.

Rack Let's touch on Rack here. Rack goes between the Ruby framework and the application server and acts as a link between them. By using Rack, the server converts the sent HTTP request into a form that can be understood by the application. On the contrary, the response from the application is converted to HTTP through Rack and returned to the server. Rack allows you to freely combine servers and frameworks.

Summary

I will summarize the contents so far. The web server receives the request sent from the browser, and if it is static web content, returns a response to the browser. However, if the request is dynamic web content, it is not processed by the web server and sent to the application server. Then, the application server tells the application through the middleware. When the process is complete, return the results to the browser in the reverse order.

reference

Difference between web server and application server IT Glossary Difference between web server and application server in Rails development (translation)

Recommended Posts

What is the difference between a web server and an application server?
What is the difference between a class and a struct? ?? ??
What is the difference between an action and an instance method?
What is the difference between SimpleDateFormat and DateTimeFormatter? ??
What is the difference between System Spec and Feature Spec?
[Rails] What is the difference between redirect and render?
What is the difference between skip and pending? [RSpec]
What is the difference between Java EE and Jakarta EE?
[Rails] What is the difference between bundle install and bundle update?
[Java] What is the difference between form, entity and dto? [Bean]
What is the difference between the responsibilities of the domain layer and the application layer in the onion architecture [DDD]
Rails web server and application server
Jersey --What is Difference Between bind and bindAsContract in HK2?
Understand the difference between each_with_index and each.with_index
[Ruby] Relationship between parent class and child class. The relationship between a class and an instance.
[Ruby] Difference between symbol variables and character string variables. About the difference between [: a] and ['a'].
About the difference between irb and pry
What do you need after all to create a web application using java? Explain the mechanism and what is necessary for learning
[Spring Boot] Precautions when developing a web application with Spring Boot and placing war on an independent Tomcat server
[Java] Understand the difference between List and Set
[Rails / ActiveRecord] About the difference between create and create!
Understand the difference between abstract classes and interfaces!
[Java] Difference between equals and == in a character string that is a reference type
Shows how many years and months the difference from a particular date is
Learn while making a WEB server Introduction to WEB application development from the basics
What to do if you get an "A server is already running." Error when you try to start the rails server
[Ruby] I thought about the difference between each_with_index and each.with_index
[Rails] I learned about the difference between resources and resources
What is an interface?
About the difference between classes and instances in Ruby
What is an initializer?
What is an operator?
Compare the difference between dockerfile before and after docker-slim
What is an annotation?
Understand in 3 minutes! A very rough explanation of the difference between session and cookie
Create a JAVA WEB application and try OMC APM
I tried to make a web application that searches tweets with vue-word cloud and examines the tendency of what is written in the associated profile
Difference between vh and%
[Rails] I investigated the difference between redirect_to and render.
What is a Servlet?
What is web development?
Difference between i ++ and ++ i
[Swift] UITextField taught me the difference between nil and ""
[For Ruby beginners] What is the difference between puts print p? Actually, there is a clear way to use it properly!
I will explain the difference between Android application development and iOS application development from the perspective of iOS engineers
Now in the third year, the misunderstanding that I noticed is the difference between the equals method and ==
An application that acquires the value of the accelerometer by UDP communication between C # and Android
[Docker-compose] Difference between env_file and environment. Priority of environment variable application
Difference between Java and JavaScript (how to find the average)
What is the LocalDateTime class? [Java beginner] -Date and time class-
The first WEB application with Spring Boot-Making a Pomodoro timer-
About the difference between "(double quotation)" and "single quotation" in Ruby
[Java] Check the difference between orElse and orElseGet with IntStream
[Java] A class is an OS, and an instance is a virtual computer.
Let's override the difference between == (identity) and equals method (equivalence)
The difference between programming with Ruby classes and programming without it
Logback log is not output when the server application is closed
Is short-circuit evaluation really fast? Difference between && and & in Java
[Memorandum] What is an error?
What is a wrapper class?
What is a Ruby module?