A
A
Andrey2017-10-02 10:54:24
Ruby on Rails
Andrey, 2017-10-02 10:54:24

What is an application instance?

Could not find a concrete explanation of what this means in practice.
I used to think that this is, roughly speaking, a running server (for example, puma) or a memory area on which the code that processes requests is executed.
Then why do they say that several application instances are running?
In the context of rails, what is responsible for working with an application instance?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
oh_shi, 2017-10-02
@andreychumak

Here you have a controller that processes incoming requests. For each request, it receives a variable from the instance parameters, for example "@var". Its value is unique for each request. This is how the application executes the same code, but for different inputs.
With the default settings of your server, requests are queued and executed sequentially. But if the load starts to exceed the capabilities of such a solution, then you can start running the application in several instances. This means running the same code in multiple processes (workers) or even on different servers.
Example: a load balancing server (1 server) splits requests into several instances (n servers) where the same application is running, but they all access the same database (1 server).

V
VoidVolker, 2017-10-02
@VoidVolker

Instance is an anglicism "Instance", in the context of programming it is translated as "object instance". For example, we have a notepad window - this is one instance of the "notepad" application or one instance, we launch another notepad - we get two instances. Likewise with any other objects.

A
Andrey Andreev, 2017-10-02
@b0nn1e

Well, applicable to local development:
rails s -p 3001 -P tmp/pids/server1.pid this is the first instance,
rails s -p 3002 -P tmp/pids/server2.pid this is the second instance.
Perhaps a separate server with an application was meant - one instance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question