Source/wechat official number: Programming Refers to north (ID: CS_dev)

When I was in college, I heard that Ali, Meituan, jingdong department is a Java school, only Goose factory has its own school, C/ C++ as the main backstage development language.

Why is that? Xiaobian also want to know!

1、为啥选择 C++

In fact, I guess the reason is very simple:

One is inertia. Every company has a stack of technology.

Goose factory in the long-term use of C++ process, developed a large number of internal components based on C++ can be used, KV storage, RPC, micro-service framework and so on.

And have a dedicated team to maintain and through the production environment test, can C++ components are very rich and stable.

The team was also more familiar with C++ and had no reason or motivation to cut other languages, so they kept going further and further down the C++ path.

The other thing is that the genes of the two companies are not quite the same.

Goose factory early is to do pager start, and then made QQ, you can see are and network, communication related to some software, this kind of basic are C/C++ development.

I remember that since the birth of QQ, the growth of users was parabolic, for which THE QQ background server was on the verge of limit for many times, and the server cost increased by a huge amount.

Tencent at that time is not how to make money, with C/C++ in higher performance, the same number of servers can support the number of users should also be large, so it should be used later.

And then into the game industry, and the game is particularly sensitive to delay, so generally used C++.

It is said that Ali started in yellow Pages at the early stage, and it was still PHP at that time. Later, it switched to Java to do e-commerce. The characteristics of toB businesses such as Taobao and Meituan are complex, and Java is generally chosen by many people.

2, how to write background in C++?

When I was learning C++ in school, I was curious about how C++ wrote background services.

Because C++ does not have a complete open source ecosystem…… Unlike Java, Node, PHP, Flask these languages, all have corresponding Web framework, after learning the language can be used to write a background service framework.

But C++ really doesn’t know how to write, and write to a static HTTP WebServer.

After I came to Tencent as an intern last year, I didn’t know how these big companies built their background services with C++.

Since xiao bei is in wechat, we will take wechat’s technology stack as an example to talk about what kind of experience it is to do background development in wechat C++.

The experience is a lot like Java!

Yes, the efficiency and feel of development is very close to Java, thanks to the basic components written by the big boys.

3. Wechat background development experience

Wechat background mainly uses C++, background services are built with Svrkit framework, and services communicate with each other through synchronous RPC. Some information can also be found on baidu.

Photo source: infoQ

Svrkit is mainly used for the development of background microservices framework, basically development trilogy:

(1) Develop communication protocols and define PROTO files

(2) Generate the service framework code based on the proto file with the command

(3) Populate functions (services) that process business logic

Is it like a framework like SpringBoot? Basically, the business only needs to focus on data model design, data storage, communication, and then implementing the concrete business logic.

The framework automatically takes care of unpacking, network communication, failure retries, and other things that microservices frameworks should do.

This is the development of the background RPC service, but we know that the external interface is generally HTTP, so here we need to use a layer of access layer to do some protocol conversion and parameters, signature verification and other work.

This layer is usually called CGI. CGI can be developed in PHP or written in C++. The purpose of this layer is to provide HTTP (usually JSON) access interface externally, and then call back RPC service (protobuf).

Of course, the wechat client and the background RPC service between the wechat custom protocol.

Therefore, there is no significant difference in development efficiency with Java.

Of course, not all of goose factory is C++ development, almost mainstream background language, will have different teams in use, especially some new business, without historical debt, will also use Go, Java and so on.

But the background of wechat is almost C++ dominated, so those who want to do the background of wechat can learn C++. Although it is said that the school enrollment does not limit the language, it is a plus to be proficient in C++.

In wechat, many components developed in the background are self-developed, such as KV for storage (MySQL is less used), message queue, RPC framework, etc.

These learning is very fast, after all, the technical ideas are universal, just change the implementation form, call interface.

If you want to experience C++ development background services, you can go to see sogou open source SRPC, including baidu BRPC, Google GRPC are so, with very similar.

As a programming learner, if you want to improve your programming ability, learn C/C++ programming knowledge, and strive to become a high-paying software development engineer in the future!

C language C++ programming learning exchange circle, **QQ group [464501141] ** wechat public number: C language programming learning base

Share (source code, project actual combat video, project notes, basic introduction tutorial)

Welcome to change careers and learn programming partners, use more information to learn and grow faster than their own thinking oh!

Programming learning books:

Programming learning video: