40
头图

The whole set of thoughts and ideas is a kind of flash of light. I went to get the second shot yesterday. After going through a whole set of procedures, I found that the whole set of process planning is very interesting. I feel that the whole set of processes fits the architecture of the popular microservices in recent years. Thought.

The whole process can be seen from the inside of fuse, current limit, message notification, queue, buffer, load balancing, etc.

Global load balancing

In a city, there are many people who can get a vaccine. When you need to get a vaccine, you need to make an appointment or sign up. Once you make an appointment, it is equivalent to the browser starting a network request. There are many vaccine service stations in a city. For people who want to get a vaccine, there are many places to choose, but users don’t know which vaccine service points are idle. Vaccine service providers can assign users to different services. point. And this process is global load balancing .

key technology of 1610d0f6e2be01 global load balancing is intelligent DNS , which can resolve the domain name that the client needs to access to different lines of different data centers through a variety of load balancing strategies, such as the nearest line through the IP geographic information database. , Or weigh the busyness of different lines to resolve to idle lines and so on.

For the vaccine service provider, it is to distribute users to a nearby service point, and then issue a vaccination certificate to the user to inform the user that it can go to the vaccine.

Ingress gateway

After arriving at the vaccine service point, you will first enter the entrance. There will be several security personnel or service personnel at the entrance. There may be one, several or even dozens of people who come to get the vaccine at a time. Less than these service personnel), some service personnel will be idle, and when there are too many people, they will be queued to deal with the questions of these personnel, and then distribute to the next steps.

In this process, the service personnel actually act as a kind of gateway, load balance the service, and send it to the idle position. In addition, this process is generally faster, and then fewer personnel can be arranged, which corresponds to less server resources.

Take number

After the entrance is processed, the user will enter the number picking stage. When picking up the number, two people will be arranged to process it. After the user is processed at the entrance, the user will enter the number picking area in the form of a queue. The entrance is To solve some of the user's questions and load the follow-up service again, the formal follow-up service will start when the number is obtained. number, the certificate will be verified. If there is no certificate for vaccination, the vaccination will be notified. This process can be said to be a 1610d0f6e2beb3 interceptor process, which intercepts unreasonable service requests.

After intercepting, the exception can be interleaved, then the exception needs to be handled, such as telling the user how to obtain credentials and how to make an appointment. If you write a program, this process requires a special exception handling, but because it is a human, it will be very flexible. In the process of taking the number, exception handling will be carried out by the way, and the user will be asked which community the user is, and then the user will be notified What to do with the next steps.

Global buffer

Regarding the program concept of the buffer zone, we will not explain it here. Let's focus on the buffer zone in the process of vaccination. After getting the number, the user will enter the buffer zone. The buffer zone is a temporary shelter with air-conditioning and chairs. The user can wait here.

With the buffer, users can wait for subsequent services in the buffer in an orderly manner, so they won't run around randomly and are easy to manage. It will not have a direct impact on subsequent services.

From what I have seen, this buffer is the largest and also the most important buffer. I call this "global buffer". In fact, from a global perspective, this does indeed serve as A global buffer.

notification

The entire vaccine service process is full of message notifications, which rely on big speakers hung at each service location. From the design of the program, the content of the message notification should be lightweight, simple enough, and fast enough. Corresponding to the vaccine service here, the message is indeed light enough, basically: "Please go to the vaccine waiting room before the two thousand, please go to the vaccine waiting room before the two thousand, and the vaccine waiting room before the two thousand. ". It can be seen that the message is light, and the message is light and fast enough. In addition, it can be seen here that it has been said three times. This can be regarded as a message retry method. Because it is a one-way message communication, multiple messages can ensure that the service receiving the message completely receives the message.

Of course, there may be people who go to the toilet here, causing the message to be missed. For those who are waiting in the buffer zone, you can ask the buffer zone service staff to confirm the message. The service staff here again as the 1610d0f6e2bfe2 exception handler.

Vaccine buffer

The process of vaccinating is a process of generating actual services, and the vaccine service is indoors. When you enter the room, you will check the number voucher. This number voucher is the voucher you get when you get the number.

In addition, the person who received the message notification from the number-taking buffer will enter the buffer once during the process of getting the vaccine. However, this buffer has a smaller capacity and will be faster because of its small capacity. When entering the buffer to wait, you will receive a message notification at this time. After receiving the message notification, users within the number can enter the vaccination process.

After passing the verification by the security personnel at the door, enter the vaccination room.

queue

The queue is also used to handle buffering, but the queue is more lightweight. After entering the actual process of vaccination, you will wait in line for service. For example, if you need to build a file, you need to verify whether it is the second shot of the vaccine. If the appointment is for a vaccination service, then it will enter the related process of a vaccination.

Multi-process

The process of vaccinating is a multi-process process. The process of establishing a file and verifying what injection is also a process of multi-process, each process will have several people to process.

The queue enters the multi-process verification process, and after passing, a new queue will be generated. The queue pushed after verification is the same. Because each staff who handles verification and file creation is inconsistent, concurrency will occur. For example, if two people enter the queue at the same time, this process will produce an effect similar to a lock. For example, if two people or even three people enter the entrance of the queue, the staff will let the staff wait, and then quickly arrange to enter the queue. And if there are too many users entering the queue, then a small buffer will be entered at this time. You can sit in this buffer for a while, or choose to look at your mobile phone for a while, and then wait for the queue to be free and arrange to enter the queue again.

The actual process of vaccinating is then dequeued from this queue and enters multi-process processing again. There seems to be something unreasonable in this process. From a logical point of view, it should be directly flowed into the subsequent bound vaccine staff after the multi-threaded link has been established and verified, without having to enter the same queue again. Then the staff who vaccinated in the follow-up took it from the queue.

But in fact, this arrangement has certain rationality. First of all, the staff who handles the filing and verification and the staff who actually vaccinate are not matched. After entering the queue, unified arrangement is a good plan. Generally speaking, this queue is sufficient if there are no accidents. Fast. In the case that it is not fast enough, a buffer is provided to solve the problems of concurrency and blocking.

Monitoring, feedback, governance

Monitoring this is a good understanding, there will be dedicated staff to check, feedback, coordinate, and collect information on the entire system. With these things, you can provide information to the global load balancing, so that you can get the traffic inflow that matches as much as possible.

The information collected in all aspects can be used to improve the entire system itself, so that the resources of the entire system can be better utilized, and will not let the staff reach a very tired state, and will not leave certain staff in a very idle state. . And to repair and adjust internal problems.

Clustering and servicing

On the whole, a vaccine service point can actually be regarded as a cluster, because the final result is that multiple staff vaccinate people who need to be vaccinated, forming a vaccine cluster.

When zoomed in, each vaccine service point (cluster) is enough to form a complete service system.

If the entire vaccine system is regarded as a service, then various government service systems constitute the entire city, and the mutual invocation of various city service systems constitutes a complete set of micro-service system architecture.

postscript

Programs are derived from the abstraction of life. Sometimes, thinking about life scenes is still very interesting. Thinking from life scenes can strengthen the understanding of abstraction, and abstract ideas can provide guidance for the processing of real life matters. .


kumfo
6.7k 声望4.1k 粉丝

程序生存法则: