If you say Taoxin potter, high availability is even more important than high performance. Why?
Because you optimize the performance of the system 10 times times, your boss may say: "Xiao Dong Ah, good job."
However, if you are responsible for the module, Zooey will be down, hey, you know.
Availability Metrics
99%-----website year unavailable for less than 88 hours
99.9%---website year unavailable for less than 9 hours
99.99%---website year is less than 53 minutes
High-availability architectures most Internet companies use PC-class servers, open-source databases, and operating systems, which, of course, cost savings, but on the other hand, server outages are a big probability event.
Therefore, the main purpose of the high-availability architecture is to ensure that the server hardware failure, service is still used.
The main means is redundancy and backup. Once a server has a problem, switch the service to another available server.
Typical site architectures such as:
The data layer is a good explanation, I'll talk about the application layer and the service layer.
The application layer is the specific business logic
And the service tier is the service that can be reused.
To give a simple example, Baidu's post-bar and liberal arts are different applications, but they all need to login, and landing service is a reusable service. Such as:
The server for the application tier is combined with a load balancer device, and if a server is unavailable, the Load Balancer service device is aware of the heartbeat device and rejects the failed server address from its list of clusters.
The service that takes the layer is called by the application layer's business through the Distributed service framework (such as Dubbo), and multiple services are managed through the registry (such as Zookeeper), and when a server fails, the registry rejects the unavailable address.
Data-tier servers typically replicate data synchronously. Once a server has a problem, the new request is forwarded to the normal server.
In addition, the site in addition to because of hardware failure will cause the service is not available, the system upgrade updates will also appear to be unavailable, so the system Upgrade update we also have to consider.
Here we are from, applications, services, data three levels to say how to achieve high availability
Highly available applications here Server score two 1 stateful server 2 server with no status
For servers with no status, simple, straightforward load balancing is OK
For those stateful server, in fact, the complex is the session, the first access in the server a,session also on Server A, the second request is assigned to B, can b inside there is a session.
For the management of the session, also divided into several
1 session replication, that is, n servers in the cluster, each server has the session information. If the number of servers, the number of users, this scheme is not appropriate.
2 session binding, which allows a user to access only server A, and User B only accesses a single server. What happens to user A if server A is down?
3 Using Cookies,
4 Use session server. (Large Web site architecture is optimal)
The high-availability service itself is stateless (if the service is designed to be stateful, then you can reflect on it), then using simple load balancing is OK.
Besides, we have some other tips.
1 tiered management enables core applications to use high-performance hardware (user payments are more central than post-evaluation feedback)
2 Timeout setting if n units of time, no response, re-send the request.
3 Asynchronous calls
4 Service demotion is when the high concurrency, some of the non-important functions first shut down.
5 Idempotent Design This is not a recommendation, but a requirement, which is to ensure that a service invocation is consistent with the effect of invoking n times.
Because the application side will call the server again if it does not receive feedback (this may have been successful, but the application did not receive it)
High-availability data guarantees high data availability there are generally two ways
Data backup and fail-over
The former ensures that data is not lost and that the latter guarantees access to the correct data at all times.
So specifically, what is high-availability data? or where is high availability?
1 Data Persistence-----Technology storage failure, data is also present.
2 Data Accessibility----A problem with a data server that can switch user access to a new data server quickly (with little user awareness)
3 Data consistency
We generally believe that the system cannot simultaneously meet data consistency (consistency), data availability (availibility), partition tolerance (Partition tolerance, scalability across network partitions)
In general, data consistency is also divided into the following scenarios
3.1 Strong data consistency the data for each copy is the same, which is guaranteed when the data is updated
3.2 Data user consistency the data of each copy is the same, but the user obtains the data to be verified, guarantees the user obtains the data is correct
3.3 Data eventual consistency physical storage of data is not the same, the user obtains the data is also different (the same user multiple access, multiple users simultaneously access), but over a period of time (usually shorter), the physical information will be automatically consistent.
Large Web sites typically choose to harden availability and partition tolerance to some extent to abandon consistency.
Large website Technical Architecture reading notes 4 high-availability architecture