The issue of capacity planning should be addressed more in the early stages of any web project. "The Fall," the server (as it always happens unexpectedly, at the wrong time) is fraught with very serious consequences - both morally and financially. Initially, the problem of lack of server performance due to increasing loads can be solved by increasing server capacity, or to optimize the algorithms, code, and so on. But sooner or later there comes a time when these measures are insufficient.
We have to resort to clustering: multiple servers together in a cluster; the load is distributed between them using a set of special techniques called balancing. In addition to addressing the problem of high loads clustering helps to ensure redundancy of servers to each other.
The effectiveness of clustering depends on how distributed (balanced) load across cluster members.
Load balancing can be carried out using both hardware and software tools. On the basic methods and algorithms and balance we would like to tell you in this article.
Levels Balancing:
Balancing procedure is performed using a whole range of algorithms and techniques that comply with the following levels of model OSI:
Network;
Transport;
Applied.
Consider these levels of detail.
Algorithms and methods for balancing
There are many different algorithms and methods for load balancing. When choosing a particular algorithm, we must proceed in the first place, the specifics of a particular project, and secondly - of the goals. Which we plan to achieve.
Among the purposes for which use balancing, you need the following:
Justice: it is necessary to ensure that the processing of each request allocated system resources and prevent the occurrence of situations where a request is processed, and all the others waiting for their turn;
Efficiency: all of the servers that process the requests, must be occupied by 100%; it is desirable to avoid a situation where one server is idle in anticipation of requests for treatment (immediately specify that in actual practice, this goal is achieved not always);
Reducing the time of the query: need to ensure a minimum time between the beginning of a query (or queued for processing) and its completion;
Reducing the response time: it is necessary to minimize the response time to user requests.
It is also desirable that the balancing algorithm had the following properties:
Predictable: it is necessary to clearly understand in what situations and under what load algorithm will be effective for the task;
Uniform loading of system resources;
The algorithm should continue to operate when the load increases.