When the programmer opens the plug-in
Chapter 42 Big Brother, You're Going to Receive Your Magical Powers
Chapter 42 Big Brother, You're Going to Receive Your Magical Powers
Although the alarm came from the development environment, this product is of great significance. They have issued a military order. If there is any problem, they will go to see it.
To be honest, they have been working for several years, and this is the first time they have encountered such a project. This is a question of whether they will stay or not.
The alarms are in the development environment, which is great for them.
After the problem is found and solved, the same problem will not occur when going online. If the problem is not found in the development environment, but only occurs when the problem is online, then they really can't explain it.
On the way back, several of their developers were still communicating.
"What the hell is going on, why does the load on the development environment suddenly increase?"
"Yeah, is there a bug?"
"Everything is waiting to go back. We will check and check the code carefully, and we must find out the reason, and we can't go online with the problem." This is what the leader of their development said.
Song Feiyi led the overall structure of this development. He is the person in charge of the development team and also the architect. He is responsible for all the technology selection this time.
His technical selection this time is still very good. When uploading, whether it is a binary or a url that needs to be grabbed from another website, he first puts it into a local redis (a memory database, which is very fast) ), and also write this information into the message queue.
In this way, more than n physical machines online can be used for distributed operations.
Doing so can not only avoid the pressure of accessing one main redis, but also utilize the memory on multiple machines, directly connected to the local database, so the read and write speed will be very fast.
After putting the data locally, a task flag will be returned to the uploader, and the data of this task is written to the public database.
Because the uploader may come to ask after a while, whether the upload of the picture just now was successful, if it is successful, what is the access address, if not, please tell me, I will ask again later.
But when the uploader asks, the server has load balancing. (One exit, with many machines behind it, you can imagine Baidu’s domain name. There are many physical machines under it, but only one domain name is exposed to the outside world, which is baidu. Similarly, other large websites are basically this Routine, but there are not as many machines as Baidu)
There is load balancing, so it is not sure which one the action of this question will fall on. In fact, there is a high probability that it will not be the one just uploaded.
So when someone comes to ask, you need a main library that can be accessed by any machine, from which you can retrieve some information about the upload task just now and return it to the person who asked.
This is the client polling for the result. In fact, there is also a callback, which is written when the picture is uploaded, and a notification interface. If it succeeds, the server will call this interface and tell it the result.
Then there is the question of how the uploading machine saves the data of the picture.
Seinfeld started a task scheduling system on each machine.
This scheduling system will sequentially send the messages in the message queue just now to the consumers, and the consumers will actually perform the upload operation.
In fact, to put it bluntly, it means storing a binary data in a database cluster, but this is a special database, not the common mysql (it is also a database, and the content is stored on the disk).
Then update the information in the public database, so that when someone asks again, it can tell the other party which address to use to access.
This kind of architecture is very good to use online, but it is basically not very useful in the development environment.
After all, there are only two physical machines in the development environment, and the advantages of the architecture he designed cannot be fully utilized.
In fact, under normal circumstances, the development environment uses a virtual machine, which is still a low-profile one, and many projects share this.
Song Feiyi said that their development environment only has two physical machines, which is too irritating.
But even if the advantages of this structure cannot be brought into play, then they should not call the police!
Song Feiyi couldn't figure out what was wrong with the link that could force the two physical machines to this point.
Back at their workstations, they immediately logged into the machine to check for problems.
However, the two servers were severely stuck, and they were very slow to log in.
Using a few commands unique to linux (and windows, macos, which is an operating system, which is mostly used by Internet servers), they quickly saw where the problem was.
It is because the CPU usage is extremely high, so the load on the entire system is pulled up.
Network connection, file reading and writing, and memory are all fine.
"Why does the cpu take up so much." They looked at the process, and it was the nginx (a web server) process that took up a lot of cpu.
A person asked in the test group, "Have you done anything? The server is very stuck now, and the load is extremely high."
【No】
【No】
……
Several people said that no special operations were done.
Cheng Wen also saw the news, and he thought deep down, it can't be my problem, right?
[I did a gray box test]
Cheng Wen decided to confess as soon as possible, otherwise it would be bad if someone caught him.
"Grey box testing, what function did you test?" A developer came directly to me.
"The test is the scaling of the specified parameters when downloading."
"Okay, thank you, I know where the problem is, I'll take a look."
When he returned to his workstation, Song Feiyi also saw some clues from the nginx log.
It seems that several requests are causing this problem.
"It should be a problem with scaling." The developer who went to ask Cheng Wen directly said to the others.
"Well, I also found this problem, why is this parameter so large?" Sein Feiyi saw a problematic parameter from the log.
When zooming, there is generally a fixed size, hundreds of times by hundreds, and at most thousands by thousands, but these few access links, just the URL displayed is more than ten centimeters long.
It is normal to see other requests on the screen, but this one has an extra line.
"Damn it, did you just scale it up abruptly, without limiting the size?" Song Feiyi thought of a possible reason.
"Careless, careless."
While saying this in his mouth, the movements of his hands did not stop at all.
"You ask Cheng Wen to stop his script first, I know the problem, and I will modify it immediately." Song Feiyi said to the person who came back just now.
"Ok."
[Brother, you should quickly receive your supernatural powers! 】
Cheng Wen: ...
[Okay, I will stop the script now]
Cheng Wen knew that the problem had been found, and he was also very happy. He finally found the bug before going online, so that he would not be afraid of major accidents when it went online.
Otherwise, not only the development is responsible, but they are also responsible for these tests, who made them fail to test this problem.
In fact, other people have also tested this function, but they did not test it with such a large value.
Ps:
This is a case encountered in practice. The project has been running stably for many years without any problems, but once a problem suddenly appeared, and after troubleshooting, it was found that there was such a bug.
I don't know if it was there at the beginning, or if it was changed in the middle, anyway, there is this problem online.
Ask for recommendation, ask for collection!
(End of this chapter)
Although the alarm came from the development environment, this product is of great significance. They have issued a military order. If there is any problem, they will go to see it.
To be honest, they have been working for several years, and this is the first time they have encountered such a project. This is a question of whether they will stay or not.
The alarms are in the development environment, which is great for them.
After the problem is found and solved, the same problem will not occur when going online. If the problem is not found in the development environment, but only occurs when the problem is online, then they really can't explain it.
On the way back, several of their developers were still communicating.
"What the hell is going on, why does the load on the development environment suddenly increase?"
"Yeah, is there a bug?"
"Everything is waiting to go back. We will check and check the code carefully, and we must find out the reason, and we can't go online with the problem." This is what the leader of their development said.
Song Feiyi led the overall structure of this development. He is the person in charge of the development team and also the architect. He is responsible for all the technology selection this time.
His technical selection this time is still very good. When uploading, whether it is a binary or a url that needs to be grabbed from another website, he first puts it into a local redis (a memory database, which is very fast) ), and also write this information into the message queue.
In this way, more than n physical machines online can be used for distributed operations.
Doing so can not only avoid the pressure of accessing one main redis, but also utilize the memory on multiple machines, directly connected to the local database, so the read and write speed will be very fast.
After putting the data locally, a task flag will be returned to the uploader, and the data of this task is written to the public database.
Because the uploader may come to ask after a while, whether the upload of the picture just now was successful, if it is successful, what is the access address, if not, please tell me, I will ask again later.
But when the uploader asks, the server has load balancing. (One exit, with many machines behind it, you can imagine Baidu’s domain name. There are many physical machines under it, but only one domain name is exposed to the outside world, which is baidu. Similarly, other large websites are basically this Routine, but there are not as many machines as Baidu)
There is load balancing, so it is not sure which one the action of this question will fall on. In fact, there is a high probability that it will not be the one just uploaded.
So when someone comes to ask, you need a main library that can be accessed by any machine, from which you can retrieve some information about the upload task just now and return it to the person who asked.
This is the client polling for the result. In fact, there is also a callback, which is written when the picture is uploaded, and a notification interface. If it succeeds, the server will call this interface and tell it the result.
Then there is the question of how the uploading machine saves the data of the picture.
Seinfeld started a task scheduling system on each machine.
This scheduling system will sequentially send the messages in the message queue just now to the consumers, and the consumers will actually perform the upload operation.
In fact, to put it bluntly, it means storing a binary data in a database cluster, but this is a special database, not the common mysql (it is also a database, and the content is stored on the disk).
Then update the information in the public database, so that when someone asks again, it can tell the other party which address to use to access.
This kind of architecture is very good to use online, but it is basically not very useful in the development environment.
After all, there are only two physical machines in the development environment, and the advantages of the architecture he designed cannot be fully utilized.
In fact, under normal circumstances, the development environment uses a virtual machine, which is still a low-profile one, and many projects share this.
Song Feiyi said that their development environment only has two physical machines, which is too irritating.
But even if the advantages of this structure cannot be brought into play, then they should not call the police!
Song Feiyi couldn't figure out what was wrong with the link that could force the two physical machines to this point.
Back at their workstations, they immediately logged into the machine to check for problems.
However, the two servers were severely stuck, and they were very slow to log in.
Using a few commands unique to linux (and windows, macos, which is an operating system, which is mostly used by Internet servers), they quickly saw where the problem was.
It is because the CPU usage is extremely high, so the load on the entire system is pulled up.
Network connection, file reading and writing, and memory are all fine.
"Why does the cpu take up so much." They looked at the process, and it was the nginx (a web server) process that took up a lot of cpu.
A person asked in the test group, "Have you done anything? The server is very stuck now, and the load is extremely high."
【No】
【No】
……
Several people said that no special operations were done.
Cheng Wen also saw the news, and he thought deep down, it can't be my problem, right?
[I did a gray box test]
Cheng Wen decided to confess as soon as possible, otherwise it would be bad if someone caught him.
"Grey box testing, what function did you test?" A developer came directly to me.
"The test is the scaling of the specified parameters when downloading."
"Okay, thank you, I know where the problem is, I'll take a look."
When he returned to his workstation, Song Feiyi also saw some clues from the nginx log.
It seems that several requests are causing this problem.
"It should be a problem with scaling." The developer who went to ask Cheng Wen directly said to the others.
"Well, I also found this problem, why is this parameter so large?" Sein Feiyi saw a problematic parameter from the log.
When zooming, there is generally a fixed size, hundreds of times by hundreds, and at most thousands by thousands, but these few access links, just the URL displayed is more than ten centimeters long.
It is normal to see other requests on the screen, but this one has an extra line.
"Damn it, did you just scale it up abruptly, without limiting the size?" Song Feiyi thought of a possible reason.
"Careless, careless."
While saying this in his mouth, the movements of his hands did not stop at all.
"You ask Cheng Wen to stop his script first, I know the problem, and I will modify it immediately." Song Feiyi said to the person who came back just now.
"Ok."
[Brother, you should quickly receive your supernatural powers! 】
Cheng Wen: ...
[Okay, I will stop the script now]
Cheng Wen knew that the problem had been found, and he was also very happy. He finally found the bug before going online, so that he would not be afraid of major accidents when it went online.
Otherwise, not only the development is responsible, but they are also responsible for these tests, who made them fail to test this problem.
In fact, other people have also tested this function, but they did not test it with such a large value.
Ps:
This is a case encountered in practice. The project has been running stably for many years without any problems, but once a problem suddenly appeared, and after troubleshooting, it was found that there was such a bug.
I don't know if it was there at the beginning, or if it was changed in the middle, anyway, there is this problem online.
Ask for recommendation, ask for collection!
(End of this chapter)
You'll Also Like
-
Football: The king of steals, Ronaldo and Messi broke through the defense
Chapter 134 7 hours ago -
Football: Draw a card to get a super-intelligent dragon and a flaming shot
Chapter 115 7 hours ago -
It is revealed that the collapse is the game world, and everyone's defense is broken!
Chapter 176 7 hours ago -
Genshin Impact: Mikhail is revealed on Sunday!
Chapter 154 7 hours ago -
The famous scene of Genshin Impact: Yellow Spring Gold Dust is revealed
Chapter 231 7 hours ago -
Ultraman: I'm Just a Scientist
Chapter 714 7 hours ago -
Special Forces: I, Private! Destroy the Wolf Fang at the beginning
Chapter 915 7 hours ago -
Nine Transformations of the True Spirit
Chapter 305 7 hours ago -
If I let you farm, will you become the emperor of the empire?
Chapter 241 7 hours ago -
You are a cultivator of immortality, how dare you challenge my heavenly tribulation?
Chapter 313 7 hours ago