2020 Ant Financial, Toutiao, Pinduoduo's interview summary (pure dry goods presented)

The article is a bit long, please read it patiently, it is definitely rewarding! I don’t want to hear my BB go directly to the interview and share:

  • Preparation process
  • Ant Financial Interview Sharing
  • Pinduoduo interview sharing
  • Byte Beat Interview Sharing
  • to sum up

Speaking of starting the interview, it was the penultimate week of the year, at 9 o'clock in the morning, I was still on the company bus, and suddenly received an interview call from Ant, which is not actually a real interview. The interviewer just talked to me about what they are doing (mainly to ensure the stability of the double eleven promotion, which is middleware), and they said in detail, and then communicated with me whether they are interested, I After expressing interest, I received a formal interview notice later, and finally I did not choose to go to Ant to express my apologies.

At that time, I was also going to go out to see opportunities, and by the way, to see my own strength. I was actually quite entangled at the time. On the one hand, the department now needs me and can still do something about it. On the other hand, I feel that progress has been slow in the past year, without the sense of accomplishment of rapid progress in the past, and the business and technology tend to be stable. In addition, I also belong to the kind of relatively lazy person, and I still hope to break through the status quo and continue to improve technically.

Before starting the formal summary, I still hope that my colleagues can listen to me for a while and hold my fists!

I turned on the flag I set in early 2018, and I felt ashamed. One of them is to keep writing a blog for a week, but for various reasons, I couldn't stick to it. If you think about it carefully, the main reason is that you didn't really calm down and devote yourself to the research and learning of technology. So why is this happening? To put it bluntly or because there is no target or unclear target, no target or unclear target may lead to the failure of the action.

So the question is, what is the goal? As far as I am concerned, the short-term goal is to study a certain technology in depth. For example, I am studying mysql recently, so in-depth study must be practiced and produced. Is that enough? We also need to be able to draw inferences from one another, combined with actual development scenarios, and think about what we should pay attention to in daily development. Are there any pitfalls in this? It can be seen that progress is really not a simple matter. This kind of anti-human behavior requires us to overcome our weaknesses and gradually form a habit. A truly awesome person never thinks it is so difficult to study seriously, because this has formed his habit, it is as natural and simple as getting up in the morning to brush your teeth and wash your face.

After pulling so much, I started to get into the topic, and conducted interviews with Ant, Pinduoduo, and Bytedance.

Preparation process

Let me talk about my own situation first. I did an internship at Ant for nearly three months in 2016, and then I went to my current old club with 2.5 years of work experience. It can be said that after graduation, I have been honestly upgrading from my old club. I have an internship experience with Ant, but because the time is too short, it is still a bit imaginary. So the interviewer saw that the first question on my resume was absolutely like this.

"Wow, you've been at Ant, not bad," the interviewer asked with a grin. "Yes, it's fine", I said. "Why is it only three months?" the interviewer asked with a deep face. "Wow, please explain...", I explained. "Oh, that's the case, let's start the interview," the interviewer said solemnly.

Nima, I knew that I didn't write about Ant's internship experience. I thought about it carefully later, didn't I add some material to my resume when I wrote Ant.

To get back to the subject, the preparation process actually started very early (of course, this does not mean that I always think about changing jobs when I work, because I understand that my current employer is not the end, and I still need to continue to improve). It can be traced back to the time when Ant left. At that time, I met with a lot of companies, but there weren't any big companies. I met with about 5 companies and got offers.

In my spare time, I often go to study the technologies I am interested in and the technologies used in my work, trying to understand the principles, and I will practice them myself. In addition, I have bought more than N books, and I will read them when I have time to supplement the basics. I have basically reviewed the source code of operating systems, data structures and algorithms, MySQL, JDK, etc. (I will list them at the end of the article. Books and some good information). I know that the foundation is like the shortcoming of the "barrel effect", which determines how much water can be filled.

In addition, before officially deciding to look at the opportunity, I made an outline for myself, mainly including the core points to be mastered by Java. If you don't understand, please check the information to understand. I position myself as a Java engineer, so the Java system must be well known. Many things are easy to show up when interviews are not accumulated all the year round. Learn to be worthy of yourself and don't deceive others.

The rest is looking for platforms and internal pushes. Except for Ants, Toutiao and Pinduoduo are all recruited for internal pushes. Thanks to the ant interviewers for admiring me. Maybe I will go to Ants in the future.

Platform : Maimai, GitHub, v2

Ant Financial

[Image upload failed...(image-b1e930-1603079943844)]

one side

At the same time, I did an algorithm problem, which was required to be completed within two hours, and was given an array of length N with repeated elements, and asked to output the 10th largest number. The typical TopK problem is solved by the quick sorting algorithm.

Algorithmic questions should pay attention to the legality check, boundary conditions and abnormal handling. In addition, if you want to write test cases, you must ensure that the test coverage scenarios are as complete as possible. In addition to the usual brushing algorithm questions, this kind of assessment should be no problem.

Two sides

  1. Introduce yourself
  2. Have you contributed code to an open source project? (Dubbo mentioned a bug that prints accesslog?)
  3. What are you doing in the department at present, what are the internal systems, functions and interaction processes under a brief introduction to the business?
  4. What pits have Dubbo stepped on and how did they solve them? (Said the problem of business exception capture during exception handling, and customized an exception interceptor)
  5. Begin to get into the topic and talk about your understanding of thread safety (multithreaded access to the same object, if you don’t need to consider additional synchronization, the behavior of calling the object can get the correct result is thread safety)
  6. What are the characteristics of transactions? (ACID)
  7. How to understand atomicity? (Under the same transaction, multiple operations either succeed or fail, and there is no partial success or partial failure)
  8. The difference between optimistic lock and pessimistic lock? (Pessimistic lock assumes that conflicts will occur, and locks must be acquired first when accessing to ensure that only threads acquire the lock at the same time, and reads will also block; optimistic locks assume that there will be no conflicts, and only check if there is a conflict when submitting the operation ) How are these two locks implemented in Java and MySQL? (Java optimistic lock is implemented through CAS, and pessimistic lock is implemented through synchronize. MySQL optimistic lock is implemented through MVCC, which is the version, and pessimistic lock can be achieved through select... for update plus exclusive lock)
  9. Why is HashMap not thread-safe? (Multi-threaded operation has no concurrency control. By the way, multi-threaded access will cause deadlock during expansion, and a loop will be formed. However, the problem of multi-threaded operation forming a loop during expansion has been resolved in JDK 1.8, but under multi-threading Using HashMap will also have some other problems such as data loss, so HashMap should not be used in multi-threading, but ConcurrentHashMap should be used) How to make HashMap thread safe? (The synchronize method of Collections wraps a thread-safe Map, or directly uses ConcurrentHashMap) What is the difference between the two? (The former directly adds synchronize to the put and get methods, while the latter uses segmented locks and CAS supports higher concurrency)
  10. What optimizations has been made to ConcurrentHashMap in jdk1.8? (If the red-black tree is used for the array element when inserting, the segmented lock design is cancelled, and synchronize replaces the Lock lock) Why is this optimized? (Avoid how long the linked list is when the conflict is serious, improve query efficiency, and increase the time complexity from O(N) to O(logN))
  11. Do you understand the redis master-slave mechanism? How did it happen?
  12. Have you had any experience in GC tuning? (It’s a bit false, the answer is not very good)
  13. Is there anything you want to ask?

Three sides

  1. Briefly introduce yourself
  2. How does the monitoring system work, which modules are divided into, and how do the modules interact? What database is used? (MySQL) What storage engine is used, and why use InnnoDB? (Support transaction, clustered index, MVCC)
  3. Is the order form split? How to split it? (Vertical split and horizontal split)
  4. The query process description after horizontal split
  5. What if the data that falls into a certain shard is large? (According to certain rules, such as hash modulus, range, split a single table into multiple tables)
  6. Is there any problem with hash modulus? (Yes, the data is unevenly distributed, and expansion and contraction are relatively complicated)
  7. How to solve the pressure of reading and writing after sub-database and sub-table? (One master and multiple slaves, multiple masters and multiple slaves)
  8. How to ensure that the primary key is unique after splitting? (UUID, Snowflake algorithm)
  9. Is the ID generated by Snowflake globally incremented and unique? (No, it's only globally unique, single machine increments)
  10. How to achieve a globally incremented unique ID? (Talking about TDDL's method of taking a batch of IDs at a time, and then slowly assigning them locally)
  11. Let's talk about the index structure of Mysql (Speaking of B+ tree, B+ tree can search for leaf nodes in order, because leaf nodes store data nodes and are ordered)
  12. The difference between a primary key index and an ordinary index (the leaf node of the primary key index stores the entire row of records, and the leaf node of the ordinary index stores the primary key ID. When querying, you need to do a table query). Do you have to query the table? (Not necessarily, when the query field happens to be the indexed field or part of the index, you don't need to return to the table, which is also the principle of index coverage)
  13. Where is the current bottleneck of your system?
  14. How do you plan to optimize? Briefly talk about your optimization ideas
  15. Is there anything you want to ask me?

All sides

  1. Introduce yourself
  2. Why do reverse engineering?
  3. How to understand microservices?
  4. How is service governance achieved? (Talking about the realization of current limiting, pressure measurement, monitoring and other modules)
  5. Isn't this something middleware does? Why does your department do it? (There was no separate middleware team at the time, and microservices were just launched soon, and monitoring and performance optimization were needed)
  6. Talk about the life cycle of Spring
  7. Talk about the GC process (talking about the trigger conditions and recycling process of young gc and full gc and the process of object creation)
  8. What's wrong with CMS GC? (Concurrent cleaning algorithm, floating garbage, short pause)
  9. How to avoid floating garbage? (Remember that there is a VM parameter setting that allows the young gc to be performed once before scanning the new generation, but because gc is automatically scheduled by the virtual machine, it is not guaranteed to be executed. However, there are parameters that allow the virtual machine to force the young gc to be executed once)
  10. What's the problem with forcing young gc? (STW pause time becomes longer)
  11. Do you know G1? (Learn a little bit)
  12. What is the recycling process? (young gc, concurrent phase, mixed phase, full gc, said Remember Set)
  13. How is the bottom layer of Remember Set you mentioned?
  14. Is there anything you want to ask?

Five sides

Five faces are for HRBP. I made an appointment with me in advance, mainly talking about my previous internship experience at Ant, what the department is doing, career development, welfare benefits, etc. Ali interviewers do have one-vote veto power, and they value whether your values ​​match or not, and generally prefer candidates who are honest. HR must be honest, don’t lie, as long as you lie, HR will verify it and cut it directly.

  1. Why didn't Ant stay after three months of internship?
  2. Who was the supervisor during the internship?
  3. What did the internship do? (Ask like Nima?)
  4. What do you think of technology? What technology stack do you usually use? (Ali HR is really both father and mother,)
  5. Have you been researching anything recently?
  6. What do you think of SRE
  7. Do you have any expectations for the treatment?

Finally, HR also told me that there is a shortage of people in the stability protection department, and I hope I will reply as soon as possible.

summary

Ant interviews pay more attention to the basics, so the basic skills of Java must be solid. Ant's working environment is quite good, because I am in front of the stability assurance department, and there are many separate groups, like Class 1 for three years, which is very youthful. The basic level of the interviewers is relatively high, basically P7 or above. In addition to the basics, they also asked a lot of questions about the architecture design, and the gains were quite big.

Pinduoduo

[Image upload failed...(image-553cee-1603079943844)]

Before the interview

After facing the ants, I had already heard about the unicorn Pinduoduo, and decided to go there too. First of all, I found a Pinduoduo HR in Maimai, added a WeChat chat, and sent my resume to start my Pinduoduo interview journey. I would like to thank Miss Pinduoduo HR for helping me from the interview to the offer confirmation. She is really nice.

one side

  1. Why did the ants only stay for three months? Didn't get regular? (I got a regularization, explained it...)
  2. Explanation of HashMap and TreeMap in Java? (TreeMap red-black tree, ordered, HashMap unordered, array + linked list)
  3. What is the time complexity of TreeMap query writing? (O(logN))
  4. What's wrong with HashMap multithreading? (Thread safety, deadlock) How to solve it? (Synchronize + CAS is used in jdk1.8. When expanding the capacity, use CAS to check if there are any changes. If it is, try again.) Will there be any problems in retrying? (CAS (Compare And Swap) is comparison and exchange, it will not cause thread blocking, but because the retry is achieved through spin, it will still take up CPU time, and there is also the problem of ABA) How to solve it? (Timeout, limit the number of spins, ABA can be solved by the principle variable AtomicStampedReference, the principle uses the version number for comparison) What if the number of retries is exceeded and it still fails? (synchronize mutex lock)
  5. What is the difference between CAS and synchronize? Isn't it possible to use synchronize? (CAS is optimistic lock, does not need to be blocked, the atomicity achieved at the hardware level; synchronize will block, the atomicity achieved at the JVM level. Different usage scenarios, when the thread conflict is serious, CAS will cause excessive CPU pressure, resulting in a decrease in throughput, synchronize The principle is to spin first and then block. The thread conflicts are serious and there is still a higher throughput, because the threads are blocked and will not occupy the CPU.)
  6. What if you want to ensure thread safety? (ConcurrentHashMap)
  7. How does ConcurrentHashMap achieve thread safety? (Segment lock)
  8. Does get need to be locked and why? (No, volatile keyword)
  9. What is the role of volatile? (Guaranteed memory visibility)
  10. How is the bottom layer implemented? (Talking about main memory and working memory, read-write memory barrier, happen-before, and draw thread interaction diagram on paper)
  11. How to ensure visibility under multi-core CPUs? (Thinking for a while, bus sniffing technology)
  12. Talking about the project, how do the systems interact?
  13. How much is the system concurrency and how to optimize it?
  14. Give me a piece of paper, draw a nine squares, fill in the numbers, give an MN matrix, print the MN numbers counterclockwise starting from 1, and require the time complexity to be as low as possible (inner OS: it seems to have encountered before This question, how to achieve the optimal solution) thinking. . .
  15. You can talk about your thoughts first (remembered, when to say when to change the direction of the conditions, to the right, down, left, up, and so on)
  16. What do you want to ask me?

Two sides

  1. Introduce myself
  2. Do you have any other offers? (Take the offer of ants)
  3. What is the organizational structure of the department? (Isn’t this round technical, but let’s be honest)
  4. What are the modules in the system, what technologies are used in each module, and how does the data flow? (The interviewer is a bit bald, and the level is very high at first glance) I was given a piece of paper, and I briefly drew the flow between systems on it
  5. How is the link tracking information transmitted? (The attachment of RpcContext talks about the structure of Span: parentSpanId + curSpanId)
  6. How does SpanId guarantee uniqueness? (UUID, talked about internal customization changes)
  7. In what dimension is RpcContext passed? (Thread)
  8. How is Dubbo's remote call implemented? (I talked about reading configuration, assembling url, creating Invoker, service export, service registration, and consumers through dynamic proxy, filter, obtaining Invoker list, load balancing and other processes (walala talked about more than 10 minutes), can I drink water? )
  9. How is Spring's singleton implemented? (Singleton Registration Form)
  10. Why implement a service governance framework separately? (Said that the internal microservices have just been launched soon, mainly for some monitoring and performance optimization of the services)
  11. Who is leading? Is it still in use internally?
  12. Have you ever thought about how to make it universal?
  13. Is there anything you want to ask?

Three sides

After the face of the second boss, he directly interviewed the HR, mainly asking about career development, whether there are other offers, and the intention to enter the job. By the way, the company's benefits and benefits are more conventional. But what I have to say is that if you have other offers or experience with big factories, you will get some bonus points.

summary

Pinduoduo's interview process is much simpler, after all, it is a company that has been established for more than three years. The difficulty of the interview is moderate, as long as the foundation is solid, it shouldn't be a problem. But I have to say that the work intensity is very high. Before the start of the interview, HR confirmed with me in advance whether I can accept such an intensity of work. The old iron who wants to come must be prepared.

Byte beating

[Image upload failed...(image-be2c45-1603079943843)]

Before the interview

Toutiao’s interview is the most professional of the three families. Before each interview, a dedicated HR will make an appointment with you, and the interview will be conducted after confirming that it is OK. Every time I passed the video interview, because it was always on the phone or on-site before, the video interview was still a bit unnatural. Some people think that the video interview experience is very good, of course, turnip greens have their own loves. At the worst, the interviewer's network is always disconnected, and finally hangs up unjustly (of course, some points are not answered well, which is one of the reasons). So it's still a bit regrettable.

one side

  1. Introduce yourself first
  2. Talk about the project, what does the reverse system mean
  3. Talk about the project, what technologies are used in the reverse system
  4. How to determine the number of threads in the thread pool?
  5. How to determine if it is mainly IO operation?
  6. How to determine if a computational operation?
  7. Are you familiar with Redis, and what data structures do you know? (Said zset) How is the bottom layer of zset implemented? (jump table)
  8. What is the query process of the jump table, and the time complexity of query and insertion? (Speaking of searching from the first layer, if not satisfied, sink to the second layer to find, because each layer is in order, write The time complexity of entry and insertion are both O(logN))
  9. Do you understand the red-black tree, the time complexity? (Said it is an N-ary balanced tree, O(logN))
  10. Since the time complexity of the two data structures is O(logN), why does zset not use red-black trees (jumping tables are simple to implement, and the cost of stepping on pits is low, and the red-black tree must be rotated every time it is inserted to maintain balance, which is complicated to achieve)
  11. I nodded and talked about the principle of Dubbo? (Talking about the process of service registration and release and consumer invocation) Have you stepped on any pits? (Talking about dubbo exception handling and printing accesslog issues)
  12. Does CAS understand? (Talking about the realization of CAS) Do you know other synchronization mechanisms? (Talking about synchronize and the difference between the two, an optimistic lock, a pessimistic lock)
  13. Let's do a problem, array A, 2*n elements, n odd numbers, n even numbers, design an algorithm so that the odd numbers in the array are all odd numbers, and the even numbers are even numbers.
  14. Let me talk about your idea first (start traversing from 0 subscript, if it is an odd subscript to determine whether the element is odd, skip it, otherwise look for the next odd number from this position)
  15. The next odd number? How to find? (A bit dumbfounded, thinking...)
  16. Any ideas? (It is still to traverse the array once and judge the subscript. If the attribute of the subscript does not match the element at the position, traverse the array element next to the current subscript, and then replace it)
  17. Your time complexity is a bit high. If you require O(N), what should you do (think about it for a while, and answer "Define two pointers, start traversing from subscripts 0 and 1, respectively. If you encounter an odd bit, it is an even number and an even bit is Stop at odd numbers and exchange content")
  18. Time is almost up, let's get here first. What do you want to ask me?

Two sides

  1. The interviewer is very kind, so introduce yourself first
  2. How do you understand service governance?
  3. How to achieve the current limit in the project? (Guava ratelimiter, token bucket algorithm)
  4. How does it work? (The main point is that the rate is fixed and the number of tokens is limited)
  5. If suddenly many threads request tokens at the same time, what's the problem? (Causing a lot of request backlogs and thread blocking)
  6. How to solve it? (You can put the backlog of requests in the message queue and process them asynchronously)
  7. What if I don't use the message queue? (Talking about RateLimiter's pre-consumption strategy)
  8. How is the context of distributed tracing stored and transferred? (ThreadLocal + spanId, the spanId of the current node is used as the parent spanId of the next node)
  9. How is Dubbo's RpcContext passed? (ThreadLocal) How to pass the ThreadLocal of the main thread to the thread pool? (Said that the context information is first obtained in the main thread through the get method of ThreadLocal, and a new ThreadLocal is created in the thread pool and the previously obtained context information is set to the ThreadLocal. Note that the ThreadLocal created by the thread pool must be manually created in the finally remove, otherwise there will be memory leaks)
  10. How exactly did the memory leak you mentioned happen? (Speaking of the structure of ThreadLocal, there are mainly two scenarios: the main thread still has a reference to ThreadLocal and the main thread does not have a reference to ThreadLocal. In the first scenario, because the main thread is still running, there is still a reference to ThreadLocal, then The reference and value of the ThreadLocal variable will not be recycled. In the second scenario, although the main thread does not have a reference to ThreadLocal, and the reference is a weak reference, it will be recycled at the time of gc, but the value used is not weak Reference, will not be reclaimed by memory, and still cause memory leak)
  11. Does the thread of the thread pool have to manually remove to reclaim the value? (Yes, because the core thread of the thread pool always exists, if it is not cleaned up, the threadLocals variable of the core thread will always hold the ThreadLocal variable)
  12. Then you mean the memory leak refers to the main thread or the thread pool? (Main thread)
  13. But the main thread has not all exited, shouldn't the referenced objects be recycled? (Interviewer and the memory leak are on the bar), there was a moment of silence. . .
  14. So how do you tell SpringMVC different user login information to ensure thread safety? (The explanation just now was a bit awkward. I didn't react at all. I actually answered that I was locked. My brain was a little dizzy. At this time, an hour has passed, and I feel that the situation is not good...)
  15. Isn't it enough to use ThreadLocal directly? Have you seen any code implemented by SpringMVC with locks? (A bit dizzy...)
  16. Let's talk about mysql, let's talk about the index structure (B+ tree)
  17. Why use B+ tree? (Speaking of high query efficiency, O(logN), you can make full use of the characteristics of disk read-ahead, multi-branch tree, small depth, orderly leaf nodes and store data)
  18. What is index coverage? (forgotten...)
  19. Why does Java design a parent delegation model?
  20. When do you need a custom class loader?
  21. Let's do a problem, handwriting an object pool
  22. Is there anything you want to ask me? (It feels like I haven't answered many points, is it hung up? (It really turned out to be))

summary

Toutiao’s interview is indeed very professional. Every time the interviewer will send you a video link in advance, and then start the interview on time, and the points examined are relatively complete.

Interviewers have a characteristic, they will grasp a point worthy of in-depth or you did not make it clear and go deep until you make this point clear, otherwise the interviewer will feel that you don't really understand it. The second interviewer gave me some suggestions. When researching technology, we must study the background and figure out what specific problems are solved in which scenarios. In fact, many technologies are interlinked internally. I am very sincere, and I am very grateful to the interviewer.

to sum up

It took more than a month from the beginning of the interview to the end of Toutiao Noodles, and I felt a bit exhausted physically and mentally. In the end, I got the offer of Pinduoduo and Ant, which was quite lucky. Toutiao’s interview helped me a lot. I would like to thank the interviewer again for his sincere suggestions and Pinduoduo’s HR for detailed answers to my long-winded questions.

What I want to say here is to do two things before the interview: resume and self-introduction, resume some projects you have done, and then pick a few highlights. Self-introduction is basically available in every round of interview, so it’s best to practice in advance and figure out what to say and how to say it separately. In addition, the technology mentioned in the resume must have been researched in depth by myself. If there is no in-depth research, it is best to find some information to warm up and not fight unprepared battles.

Books read these years :

"Effective Java", "Modern Operating System", "TCP/IP Detailed Explanation: Volume One", "Code Cleanliness", "Refactoring", "Java Program Performance Optimization", "Spring Combat", "Zookeeper", " "High-performance MySQL", "Core Technology of Million-level Website Architecture", "Scalable Service Architecture", "Java Programming Thought", "Microservice Architecture and Practice", "Java Concurrent Programming Practice", "Spring Boot Actual Combat"

To be honest, many of these books only read part of them. I usually read the books with questions , otherwise I fall asleep when I look at them. It's a hypnotic medicine.

** Finally, attach a piece of preparation materials before the interview

![2019 Ant Financial, Toutiao, Pinduoduo Interview Summary (Dry Goods Offered)](https://img-blog.csdnimg.cn/img_convert/358f4776b89856f5604ca672630644a8.png

Advanced Java architecture information, interview video analysis can be obtained here .

Guess you like

Origin blog.csdn.net/m0_46657043/article/details/109158152
Recommended