3 years of Java, fighting Tencent

Author: codegoose https://segmentfault.com/a/1190000017864721

After half a year of precipitation, plus the completion of MySQL, redis and distributed, I finally regained confidence in the interview and went out again.

Goose Factory

Interview position: go backend development engineer, accept to transfer language from Java

We all know that the goose factory is the main battlefield of cpp, and most of the engineers with cpp as the background have particularly high requirements on os and network, unlike Java, which is a business-oriented language.

The companies that interviewed Java before focused on data structures, networks, frameworks, databases, and distribution. Therefore, the OS has a bigger loss

One side: ** Basic technical side **

Telephone interview, casually asked some technical questions, and finally asked a medium-level algorithm in LeetCode, which is relatively simple. I probably sorted out and recalled:

  • Have you ever used redis? Common data structures and scenarios used in business.

  • How is the redis hash implemented?

  • What is the difference between rehash process and JavaHashMap rehash?

  • Have you known about redis cluster , how to achieve high availability?

  • Talk about the persistence mechanism of redis, why can't you use redis as a dedicated persistent database storage?

  • Without knowing tcp / udp, let's talk about the definition of the two. Why should tcp shake hands three times and wave hands four times?

  • How to ensure orderly transmission of tcp , talk about tcp 's fast retransmission and congestion mechanism

  • Do you know the time_wait state, where does this state appear, and what's the use?

  • Udp is an unreliable transmission. If you come to design an algorithm based on udp that is almost reliable, how to design it?

  • What is the difference between http and https? Say what problem did https solve and how? Say the handshake process of https.

  • Look at the use of etcd in your project, explain what etcd is used for, how to ensure high availability and consistency?

  • Now that you mentioned the raft algorithm, what is the basic flow of the raft algorithm? What to do if there is a split in the raft algorithm?

  • Have you understood the zab algorithm of paxos and zookeeper , what is the difference between them?

  • What database do you backend use for persistence? Have you used sub-library and sub-table, how to do it?

  • What are the common ways of indexing and what are the differences?

  • What are the MySQL storage engines and what are the differences?

  • What method does InnoDB use to implement indexing, and how? What is the difference between a clustered index and a non-clustered index?

  • Have you learned about coroutines? What is the difference between coroutines and threads ?

  • An algorithmic question, sword finger offer question 51, repeated numbers in the array?

Probably speaking about my own answer, there is no problem with redis. The specific rehash has the impression that it is progressive, but the specific principle may be slightly different.

tcp's time_wait answer is not very good. I haven't understood the implementation of the quic mechanism before, so when I asked about reliability udp, basically I followed the implementation of tcp in my mind.

There is nothing to say about https. Similar things were used in the previous project, and the research is relatively clear.

The raft algorithm just happened to brush 6.824 (only brushed to lab2 ...), the answer is also okay, but the paxos and zab algorithms are indeed unfamiliar, and directly say no.

MySQL is very familiar, including indexes, locks, transaction mechanisms and mvcc, etc., nothing to say, have been completed.

Coroutines and threads mainly talk about the difference between go and Java threads and the scheduling model of go. The interviewer reminded that there is no mention of the kernel mode switching of the thread, and the go process is only scheduled in the user mode.

The last algorithm question, first of all, said to use HashMap to do it, whether the space complexity can be reduced to O (1), and I thought about the replacement in place after about 5min.

Generally speaking, the answer is okay, just one side.

Two sides: ** Project technical side **

On the other hand, I transferred from the basic technology inspection to the project, and mainly asked me the following questions:

  • For the project you are most familiar with, draw the project's architecture diagram and the main data table structure of the project.

  • Talk about the technical points used in the project, the total peak qps of the project , and the delay.

  • Have you analyzed where the time-consuming delay occurs and what improvements have been made to the project?

  • If there is a problem with the request and there is no response, how to locate the problem and talk about the idea?

  • How to deal with tcp sticky packets?

  • Then I also asked about the cache update mode, as well as the problems and corresponding ideas that will arise?

  • In addition to company projects, have you studied well-known projects or made contributions in your spare time?

The answer on this side is also relatively smooth, because they are all around the project and they are familiar with it. Basically, there is no problem. Except that the interviewer said that the project experience is slightly weaker, the rest are good.

Three sides: ** comprehensive technical side **

This is a chaotic situation. The interviewer asks questions in a thorough manner. After all, the interview experience is not enough, which leads to a somewhat chaotic rhythm. for example:

There is a question: What is the difference between go and thread?

Answer : It takes about 4kb of memory to start a go process, and 1.5MB of memory to start a Java thread; scheduling of the go process is very lightweight in user mode, and the switching cost of Java threads is relatively high.

Then ask why the cost is relatively high? Because the scheduling of Java threads needs to be switched between user mode and kernel mode, is it costly? Why is it more expensive to switch between user mode and kernel mode? I briefly talked about the definition of kernel mode and user mode.

Then asked, still did not understand why the cost is high? My heart collapsed instantly, and it was endless. The OS piece still hurts, and I gave up for a long time.

All the following questions are in this mode, and the result is that there is no rhythm in the answer, and I feel that I am being routine. Most of them can answer one or two or even one or two or three, but the OS level will be GG later or further.

Later, I asked about the biggest challenges encountered during the next project and how to solve them?

I also asked a question about how to locate the server CPU 100%?

It may be due to the mentality of locating business problems at ordinary times, coupled with being blinded, it is casually:

  • First check the monitoring panel to see if there is any sudden traffic abnormality

  • Then check whether there is any abnormality in the business log. For a period of 100% of the CPU, take a log of a typical business process to view

  • Finally, I mentioned the use of topcommands to monitor which process is 100% occupied

Sure enough, the position was chaotic, and he opened his mouth and covered his face. .

For this problem, the original correct idea should be to use topthe process that locates the problem first , then use topthe thread that locates the problem, and then print the thread stack to check the running status.

This process can certainly be answered at ordinary times, but it is not. Still have to sum up.

Finally, I asked a system design topic (the design of the circle of friends). The architecture diagram of the system was drawn on the whiteboard. The main table structure and the main business processes were explained. If the number of users increases and the traffic becomes larger, how will the architecture expand and how to deal with it?

This answer is also a bit messy, directly from Gu Zi used a common architecture, I feel no bright spots.

Later reflections should first locate the characteristics of the business, this business is obviously read more and write less. Then communicate with the interviewer about the number of users in the first phase of the program, performance requirements, what is the stand-alone target qps, etc.?

Design after designing the characteristics and constraints of the system, instead of using the common architecture of the typical Internet to create your own solution.

Interview results: ** Received SMS after 3 days and was rejected **

to sum up:
  1. tcp / udp, http and https and the network (various network models, already selected, poll and epoll) must be very familiar

  2. Must have project experience with the project, and be able to explain clearly, make clear choices in the project, design models and data tables

  3. Distributed should be very familiar

  4. Common problem positioning must have ideas

  5. Operating system, or operating system, important things are said three times

  6. System design, ideas, ideas, ideas must be clear, and the process of system design must be summarized

  7. In a flash, I usually read more blogs and columns. If I do n’t have my own thinking, I ’m just oversighted, and I wo n’t be my own thing, just like the kernel mode and the user mode. I usually read it, but I did n’t think about it. It's really embarrassing to say that I really can't tell. Do n’t build high platforms with floating sand. It takes time to lay a solid foundation for this kind of things, and think and summarize more.

Pay attention to the WeChat public account of the Java technology stack and reply to the keyword in the background: interview , you can get a copy of the Java interview dry goods sorted by the stack leader.

I recommend going to my blog to read more:

1. Java JVM, collection, multithreading, new features series tutorials

2. Spring MVC, Spring Boot, Spring Cloud series of tutorials

3. Maven, Git, Eclipse, Intellij IDEA series of tool tutorials

4. The latest interview questions for Java, backend, architecture, Alibaba and other major manufacturers

Life is beautiful, see you tomorrow ~

495 original articles have been published · 1032 thumbs up · 1.46 million views

Guess you like

Origin blog.csdn.net/youanyyou/article/details/105504684