Baidu has been able to handle the traffic of the Spring Festival Gala, which is amazing. Some people compare Baidu’s 2019 New Year’s Eve activities to Alipay’s Five Blessings and WeChat red envelopes. Obviously BAT is worthy of its name. You can leave headlines and short videos, but you can never leave search, social networking and e-commerce.
Luo Zhenyu said in his New Year’s Eve speech on New Year’s Day that the traffic of the Spring Festival Gala is very strong. To advertise in the Spring Festival Gala, it is not only necessary to have enough money, but your server cannot crash. So Alibaba advertised in the Spring Festival Gala, but what people didn't expect was that Alibaba's servers were not good enough. However, while some Internet people are discussing that Baidu has not collapsed, programmers are more interested in another point, and that is architecture!
Some people say they want to ask a mentally retarded question, that is, what is the structure of Baidu’s red envelope grabbing activity? Is it based on C or JAVA? Some PHP masters guessed: the main venue, the yaf framework of PHP鸟哥, the php hhvm business layer, the underlying c, and the data are all in memory. Large front-end traffic scheduling golang, video and picture storage BOS system uses CDN, and there are many jobs in different places across the country. The success of the Spring Festival event is the result of Baidu’s tens of thousands of R&D efforts and the joint efforts of all business lines.
There is another programmer who likes to play King of Glory and wants to guess. He guesses that it is swim lane redis asynchronously to mysql and then asynchronously to redis. One set can support 3-5wqps, and multiple sets can be deployed using user lanes. According to Baidu's system, the probability of accessing bfe is relatively high, but the possibility of directly using nginx lua as the gateway and using php for the business layer cannot be ruled out.
A Meituan employee was a little disdainful: Are we still focusing on the data center level? Just edge computing. CDN functional calculations in various places, and then exchanging data with the data center, can block most of the traffic. The data center is nothing more than a traffic gateway entrance, followed by a business gateway diversion, and it can be layered and horizontally stacked with machines.
Although some netizens feel confused, some Alibaba employees feel that MySQL is not necessary for things like red envelopes, and Redis is the best. Some Baidu employees said: The most basic implementation is nothing more than queue memory. In fact, this is not very advanced, everyone can do it. But the architecture is different. In addition to bfe access, the backend is layered with lua, go, c, and php.
The last Baidu employee suspected of participating in this red envelope structure gave the answer, saying that the traffic distribution is golang and the business is php. After New Year's Day, the company notified us to do this. The PM developer was confused and then forced himself to do it. He worked overtime for three weeks at least 12 o'clock every day, and finally got it done. The requirements kept changing, the development kept rewriting, and the tests kept retesting... It was really only three weeks, and I admire how I survived. The code was changed to 15 versions!!!