This article will be very helpful to many programmers who do not have high concurrency experience.
Many programmers have probably encountered a similar puzzle:
I have no experience in high concurrency projects, but I am often asked questions about high concurrency and performance tuning during interviews. What should I do?
How to solve this problem? Let me tell you about one of my hiring experiences.
Programmer Xiao Zhang has been working for 5 years and is a senior engineer. I personally recruited him into the company and he performed very well.
A while ago, I called Xiao Zhang into the conference room and asked him to lead a team by himself. Among other things, I talked about how he filled his resume during the interview.
About two years ago, there was a vacancy for a senior programmer on a core project. This position is very important, so the requirements of the interviewer are not low:
- High performance, high concurrency development experience
- Experience with high availability systems
- Participate in middleware development, optimization and system storage optimization
The recruitment lasted for two months, and we interviewed many candidates who had worked for more than five years or even ten years, but still no one was particularly suitable.
Just when we were running out of hope, my colleague asked me to interview an interesting person. He strongly recommended him and handed me his resume. It was Xiao Zhang.
After receiving the resume, I looked through it first. This turn, let me frown.
According to his resume, Xiao Zhang has only three years of work experience, all of them in a company that is not well-known.
More importantly, I suspect his resume was doctored.
He said that he had been in charge of two projects in the past three years, one of which was an e-commerce project and the other was an open platform for the e-commerce project. On both projects, he highlighted the high concurrency of the projects and said he solved many technical problems.
This is where the problem arises. At that time, we also had e-commerce projects, and I was quite familiar with some well-known e-commerce platforms in the market, but I had never heard of the products in his resume. So I suspect the resume is overpackaged.
However, I don’t believe the previous interviewers missed such an obvious question. So why did they recommend me to see them?
To be honest, I’m annoyed by the over-packaging of resumes, but that’s just my suspicion. At the same time, the interviewer in front of him was unexpectedly with a kind of unprecedented satisfaction tone, told me to face him, and I was more curious about colleagues’ recognition.
In this way, I met Xiao Zhang with a mixture of anger and curiosity.
When I saw Xiao Zhang, I looked very serious because I was a little annoyed. He was probably embarrassed to see me so serious. However, FROM his eyes, I saw a strong confidence. Interesting guy, I thought to myself. I decided to have a good interview with this person to see what he could do to make my colleagues so satisfied.
After asking him about his background, he got down to business. When into the topic, xiao Zhang’s answer attitude let me greatly appreciated. Confident attitude, neither servile nor pushy, logical expression is also very clear.
At that time, I decided in my heart that IF Xiao Zhang’s follow-up answers could prove that his strength reached 80% of the level described in his resume, I would be inclined to give him the offer.
I first asked him about his understanding of high concurrency, like
What are the metrics for high concurrency?
He told me that high concurrency varies by product type. For the e-commerce system he is responsible for, different indicators are focused on according to different modules. Product browsing is QPS and order module is TPS. They also need to look at active users and so on.
That’s a good answer. Since the interview, even for those who have worked for many years, the overwhelming answer is QPS, just one more TPS. The ability to correlate different product types with different high concurrency metrics shows that Zhang has thought about the problem carefully.
I’m more and more satisfied. In the following part, I asked about performance optimization issues such as cluster deployment, multi-level caching, complex query optimization, and added various strategies for high availability of the system, and how to split to ensure flexible scaling and other practical issues we are using.
After the interview, time has passed more than an hour. Xiao Zhang didn’t answer my questions 100 percent.
In practical terms, details about performance optimizations, such as system bottleneck detection and optimization, program logic optimization, JVM optimization, and even database optimization, came in surprisingly well.
However, he only knows the big picture about the general strategy of high availability, such as downgrading and limiting traffic, and many of the answers can be heard from books or the Internet.
He even failed to answer many of the questions about the scalability of the system.
However, despite the flaws, Xiao Zhang still got the offer, and I did not discount his expected salary, which was enough to give him a big surprise.
In the following two years, Xiao Zhang’s excellent performance proved that I was right about him.
He has made great contributions to the company’s core projects, and his technical level has also been greatly improved. He became a senior programmer with high concurrency experience. So now we’re gonna let him lead the team.
“There is only one question, then. How on earth did you familiarize yourself with high concurrency performance optimization before the interview?” I was curious enough to ask the question I had been holding close to my heart.
Zhang scratched his head awkwardly and told me in detail how he handled the high concurrency experience.
I listened, is really full of praise for his preparation. I think we should share it so that more people can see it.
To highlight! If you crave a high concurrency experience, here’s what you should pay attention to.
Xiao Zhang did e-commerce platform development. However, the e-commerce platform has so few visits that QPS can probably count them on one hand. Hard to say, just hanging on the Internet.
He participated in the maintenance of this e-commerce platform just after graduation. After a year of this, he found himself unable to improve.
He wanted to change jobs, but found that many senior positions required high concurrency experience, and he was worried about it. If he had continued at his previous company, he would have had no access to high concurrency. However, if he changes jobs, he must have high concurrent experience to find a good position to continue to improve himself.
It seems to be a dead knot.
In all desperation, he decided to simulate high concurrency to gain experience.
Now summarized, in fact, his practice can be roughly divided into three stages:
The first stage
At this stage, Xiao Zhang completed the study of single machine performance optimization under the condition of high concurrency.
Zhang uses Docker containers to run the e-commerce projects he maintains. Then use jmeter, WRK and other tools to pressure measurement.
During pressure testing, he was keenly aware that each module of the system performed differently, which sparked his thinking. Through Internet search and information query, he understood that different modules and different products have different requirements for concurrency indicators.
Based on this situation, he wrote a complex pressure test script according to the business logic of the product, which can automatically realize the pressure test tasks of different modules.
It was in this constant pressure probe that he learned how to detect problems and how to fix them by optimizing the code and JVM.
For example, to solve the problem of using HashMap incorrectly causing an infinite loop. For example, the misuse of uncached file IO stream, to read files and so on.
After optimizing the program and JVM, he found problems with the database. So, he learned how to optimize the DATABASE SQL, how to database sub-table and other issues.
It was also at this stage that he realized the necessity of caching and the importance of synchronizing cached data states.
Zhang in the standalone optimization, he felt that there is no way to learn anything new through the standalone pressure test. So he moved on to the second stage.
The second stage
Zhang bought two machines from Aliyun, and he began to try to use load balancing to share the pressure of high concurrency.
Similarly, high concurrency was simulated with pressure tools. During pressure testing, the load balancing and system often have problems that are completely different from those of a single machine.
For example, there are performance issues with load balancing itself. For example, in some cases, the machine load behind load balancing is unbalanced and the load algorithm needs to be adjusted.
At this stage, Zhang understands most of the details of load balancing.
However, in high concurrency, many systems are so complex that they require distributed architecture. They need all kinds of middleware for communication, for storage.
So, According to some needs of recruitment, Xiao Zhang did the third stage of the exercise.
The third stage
In order to be familiar with the use of various middleware in the market, Zhang changed his e-commerce platform again and again.
For example, he replaced some local calls with Dubbo remote calls. Some inter-module calls, for example, are replaced by MQ middleware messaging. For example, some frequently accessed data stored in relational databases is saved in MongoDB…
Of course, the manometry continued. In this way, Zhang practiced the use of middleware and distributed frameworks.
While simulating high-concurrency exercises, Zhang did not forget to read various high-concurrency and high-performance books. For example, “Large Website server capacity Planning”, “Internet Entrepreneurship core Technology: Building scalable Web Applications” and other books.
Xiao Zhang practiced this for about two years before coming to our company for an interview.
Although There are many shortcomings in Xiao Zhang’s performance in the interview, I saw some of his advantages as follows:
1. Xiao Zhang meets the requirements of having high concurrent experience
Why do we need someone with high concurrency experience?
To put it bluntly, the programmer we’re looking for is:
- Don’t mess around with poorly performing code
- Sensitive to problems affecting the system
- Independently handle problems caused by high concurrency
Xiao Zhang has mastered these skills through his practice.
2. Xiao Zhang meets the requirements of high availability
We look for people who are familiar with high availability, but we don’t necessarily expect that person to have a unique high availability solution. What we want is for him to realize the importance of high availability after he knows about it.
For example, if there is a problem with the current limiting function, he should be able to immediately recognize that it is a very important problem and make solving it a high priority.
Through learning, Xiao Zhang understands the importance of high availability and the general direction of high availability, which is enough. We are confident to take Xiao Zhang to learn the rest of the details in practical work.
3. Xiao Zhang can participate in our middleware development and storage optimization
Xiao Zhang took the initiative to transform their e-commerce system, and used a lot of middleware, which were optimized. He is familiar with the characteristics of these middleware, and in practice, he also understands a lot of principles.
In addition, Xiao Zhang’s initiative particularly touched us. His initiative to delve into technology and learn shows that he is a person who likes to step out of his comfort zone and is willing to challenge himself. And what team doesn’t want that?
So, not having a high concurrency experience isn’t really that scary.
If you don’t have access to high-concurrency projects at work, don’t get hung up on them. You can’t change what the company does, you can only change yourself. The key is to take the initiative to learn, practice and improve. Only such a person, opportunity will go to favor.
Finally, after all, in the programmer circle, more than 90% of the people may not really have high concurrency experience, so here also hope that the interviewer, when recruiting, if you meet good prospects can be appropriately tolerant, give new people a little chance, maybe you can find a horse.
The code word is not easy, after reading it, if you think it is helpful, I hope you can casually click on the like, your support is very important to me.