The first day of high concurrency send load balancing

Send high concurrency:

At 1: Load Balancing

At 2: Database

image1.png

Under APP multiple servers, if a user logs, session how to deal with?

This article Source: Kaige Java (kaigejava)

Personal blog: www.kaigejava.com

As shown below:


image2.png

Description:

If a user logs on to a 01 server loads, other times when a user operation, if the load on 02 machines. 02 This time there is no machine above the current user session. Users will be transferred to jump to the landing page.

solution:

1: can be placed in the user's session in the cookie

Advantages: no problem to solve the session

Drawback: session on the user's browser is unsafe

2: a user session can be placed into the database

Advantages: no problem to solve the session

Cons: When a large amount of user time, if the session is placed into the database, the database will result in too much pressure. So that the database is not functioning properly

3: You can put the user's session cache server

The best solution is to: in the cache server. Here we recommend two servers cache: memcached, redis

Requirements: memcached / redis must be a cluster

4: tomcat sharing session

Cons: When too many tomcat time and affect performance. It is not recommended



Database concurrency:

1: With the increase in business, but also to increase the carrying capacity of the database library

2 data security, can not be lost

3 + disaster recovery backup support


High concurrent resolution stage of development:

The primary stage: eh system or server level access to the program

image3.png


To sum it up: the primary stage of hate hardware (server level)

Then with the increasing volume of business, hardware costs increase. We entered the second phase: the application level solutions

image4.png

To sum it up: application-level processing.

Traffic continues to increase: third stage:

image5.png

It increases the number of application servers, the attendant problem again.

Question 1: multi-user access to ip, how to solve?

Multiple servers should. Each corresponding ip certainly not the same.

Question 2: database bottlenecks are, how to solve?

IP users to solve a number of ways:

Use DNS resolution.

DNS definitions:

image6.png


DNS resolution multi-ip ideas:

image7.png

Round robin DNS.

Disadvantages:

image8.png

The ultimate solution:

image9.png

Load balancing works analysis:

image10.jpeg


Description:

image11.png


image12.png

1: a user request , forwarding the request

2: If the machine hung up

   Load balancing service will not continue to put forward the request to this server do ? 

  The answer : not

3: If the machine back to normal

  Load balancing server will add it back then ?

The answer : will

Three functions

A : Forwarding

Two : the fault is removed

Three : restoration Add


The type of load balancing:

1 ) One is to solve common hardware hardware NetScaler , F5 , Radware , and Array and other commercial load balancer, but they are more expensive

2 ) One is to be solved by software, common software LVS , Nginx , the Apache , etc. , which are based on the Linux system and open source load balancing strategy .




Guess you like

Origin blog.51cto.com/kaigejava/2437943
Recommended