Read the architectural secrets behind 100 million WeChat users

WeChat is very popular and normal, and there must be benchmarks.

Officials attribute WeChat's success to Tencent's "three-in-one" strategy: product precision, project agility, and technical support.

Ordinary people should not see it this way. First of all, "product accuracy" can be skipped. TC's cottage culture is deeply rooted, and " product accuracy " is more suitable for explaining its internal ecological environment.

The second "project agility", this is a weapon.

(1) Agility is a sign of a positive attitude, and a positive attitude is a ladder closer to good luck, and good luck is a key element of success.

(2) WeChat must tolerate that even ten minutes before the release, he must be allowed to change.

(3) Everything the R&D team does is to give product decision makers the greatest degree of freedom, and this decision is the key to WeChat winning.

(4) How to be agile?

  • Fanatical Tech Beliefs: No doubt, this is a must.
  • Big system small: When designing a huge system, it should be divided into smaller particles as much as possible, so that the impact between projects is minimal. Folk commonly known as "decoupling". What WeChat achieves is not only logical decoupling, but also deployment decoupling. Separate the physical division of different application logics,mix and match key logics together, andsplit them into 8-10 types for separate deployment.
  • Everything is extensible: In the middle of a high-stability, high-performance system, it is designed to be an immutable system for stability, but in order to support agility, everything needs to be extensible. The network protocol needs to be extended, whichcan be described by XML, and then all the codes can be automatically generated by tools. This is an important point for WeChat to achieve rapid development. Data storage must be scalable, andKV or TLV will be used.
  • Basic components must be established: when solving complex problems, the existing experience needs to be solidified, and the solidified things will become part of the system.
    • Client/Server automatic code generation framework, 10 minutes to build an internal server
    • Logic container: add new logic at any time
    • OssAgent - Monitoring/Statistical Framework: WYSIWYG monitoring report
    • Storage components - shielding complex issues such as disaster recovery/expansion
  • Easy launch: When a change is made and deployed from the development environment to the existing operating environment, the word "grayscale" is very critical in this process, that is, the choice between black and white must be changed. It is a small-scale attempt, and then gradually expands to a problem in a massive process.

The third technical support, strength witness

(1) Architecture diagram



 

(2) Technical challenges

  • From the design of WeChat, the performance of the system should be consistent regardless of whether it is online or offline.
  • Changes in the strength of mobile phone signals bring unstable factors
  • How to Minimize Transmission Problems
  • How to deal with high latency

(3) Protocol based on state synchronization

  • WeChat has made a special design in the system, called the SYNC protocol, which is implemented with reference to Activesyec. The first feature is a protocol based on state synchronization. It only needs to push a notification of the arrival of a message, and the terminal will synchronize the message after receiving the notification.
  • In state synchronization, the smallest data change can be obtained through the difference of state synchronization, and the smallest amount of data transmission can be obtained through incremental transmission. Through such a protocol design, WeChat can ensure that messages arrive stably and in sequence.

To end with a quote, what is scary is not WeChat, what is truly scary is that a team with more talent than you is ahead of you and works harder than you.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327033987&siteId=291194637