The article is a little long, please be patient to finish reading, absolutely harvest! Don’t want to listen to my BB directly into the interview to share:

  • Preparation process
  • Ant Financial interview sharing
  • Spell many interviews to share
  • Bytedance interview sharing
  • conclusion

Speaking of the interview, it was the penultimate week a year ago. I was still on the bus to the company at 9am when I suddenly received a phone call from ant for an interview, which was not really an interview. The interviewer just talked with me about what they were doing (mainly the double Eleven, which is to guarantee the stability of the company) in detail, and then communicated with me whether they were interested in it. I expressed my interest, and then received the formal interview notice. Finally, I felt sorry for not choosing ant.

At that time, I was ready to go out to see the opportunity and see my own strength. I was quite tangle, on the one hand, departments are now need me, still can have a big, on the other hand feel slow progress in nearly a year, no rapid progress before a sense of accomplishment, and business and technology should be stable, and also belongs to the kind of person who is lazy, was always want to be able to break through the status quo, sustained progress in technology.

Before starting the formal summary, I still hope that everyone can listen to me continue to vent for a while, fist clenched!

I flipped over the flag I had set at the beginning of 2018 and felt ashamed. One of them was to write a blog post a week, but it didn’t work out for a variety of reasons. Thinking carefully, the main reason is that I didn’t really calm down and seriously invest in the research and learning of technology, so why is it like this? To put it bluntly, it is because the objective is not defined or the objective is not clear. The lack of objective or the objective is not clear may lead to the failure of the action.

So the question is, what is the goal? As far as I am concerned, my short-term goal is to conduct in-depth research on a certain technology. For example, I have been doing research on mysql recently. So in-depth research must involve hands-on practice and produce some results. We also need to be able to draw inferibles, combined with the actual development scene to think about daily development to pay attention to what, there is no pit in the middle? It can be seen that progress is really not an easy thing. Such anti-human behavior requires us to overcome our own weaknesses and gradually form habits. Really awesome people, never feel serious study is a difficult thing, because it has formed his habit, drink in the morning brush teeth wash face as natural simple.

So much talk, began to get down to business, has carried on the ant, Pinduoduo and Bytedance interview.

Preparation process

First, LET’s talk about my own situation. I worked as an intern in ant for nearly three months in 2016, and then went to my current employer. I have 2.5 years of working experience. So the first question an interviewer asks me on my resume is definitely something like this.

“Wow, you spent time in ant, that’s good,” the interviewer asked with a smile. “Yes, it’s fine,” I said. “Why only three months?” “The interviewer asked, turning pale. “Rambling explanation…” “I explained. “Oh, I see. Let’s start the interview,” the interviewer said solemnly.

Damn, I knew I didn’t write the internship experience of ants, but after a careful thought, I added some spice to my resume when I wrote ants.

Get to the point, ready to process actually began in early (of course this is not to say that I the old thinking about job-hopping at work, because I know the club now is not the end, I still need to improve), specific dates back to the departure from ant, then it also face a lot of companies, nothing big companies, face about five companies, have got the offer.

In my spare time, I often do extra research on the technology I am interested in and the technology I use in my work, and try to understand the principle and practice it myself. In addition, bought more than N books, basic have time will go to see, make up the foundation, what operating system, data structure and algorithm, MySQL, JDK and other source code, basic have a good review (at the end of the article will list their own read books and some good information). I know that the foundation is like the “barrel effect” of the short board, determines how much water can be filled.

In addition, before I formally decided to look at the opportunity, I made an outline for myself, mainly including the core points to master Java, if you don’t understand the information to understand. I give myself positioning or Java engineer, so the Java system must do know, a lot of things are not perennial accumulation of interview is easy to be revealed, learn to live up to yourself, do not lie.

The rest is the platform and internal push, except ant, toutiao and Pinduoduo are all internal push by someone, thank the ant interviewer for my appreciation, maybe I will go to ant.

The ant gold dress

  • One side
  • Second interview
  • On three sides
  • All around
  • Five surface
  • summary

One side

One side to do an algorithm, required to be completed in two hours, given length N array with repeated elements, required to output the 10th largest number. Typical TopK problem, fast sorting algorithm solved.

The algorithm should pay attention to the validity check, boundary conditions and exception processing. Also, if you write test cases, make sure that the test covers as many scenarios as possible. Plus the usual brush algorithm, this assessment should be no problem.

Second interview

  • Let me introduce myself
  • Did open source projects contribute code? (Dubbo mentioned a bug about printing accesslogs?)
  • What do you do in the department now? Briefly introduce the business, internal systems, functions and interactive processes
  • What potholes did Dubbo step on and how did he solve them? (Talking about business exception catching in exception handling, customizing an exception interceptor)
  • Let’s get down to business and talk about your understanding of thread-safe (if multiple threads are accessing the same object, the behavior of calling the object will get the correct result if no additional synchronization is required).
  • What are the features of transactions? (ACID)
  • How do you understand atomicity? (In the same transaction, multiple operations either succeed or fail. There is no partial success or partial failure.)
  • What’s the difference between optimistic and pessimistic locks? (Pessimistic locking assumes that conflicts will occur, that locks must be acquired before access, that only threads can acquire locks at the same time, and that reading will block; Optimistic locks assume no conflicts, only check for collisions when committing. Java optimistic locks are implemented through CAS and pessimistic locks through Synchronize. Mysql optimistic locking can be implemented by MVCC, which is also known as the version. For update with exclusive lock)
  • Why isn’t HashMap thread safe? (multithreaded operations without the concurrency control, by the way the multithreaded access when expansion will cause a deadlock, can form a loop, but problems form the ring expansion when multithreaded operations to JDK1.8 has been solved, but a multi-threaded using HashMap will also have some other problems such as loss of data, so the multi-threaded should not use a HashMap, Use ConcurrentHashMap instead.) How to make HashMap thread-safe? What is the difference between the Collections Synchronize method that wraps a thread-safe Map or ConcurrentHashMap? (The former directly adds Synchronize to the PUT and get methods, while the latter uses staged locking and CAS for higher concurrency)
  • What are the optimizations for ConcurrentHashMap in jdk1.8? For example, if an array element uses a red-black tree, synchronize replaces a Lock with a segment-lock. Why is this optimization optimized? (Avoid the length of linked list when the conflict is serious, improve the query efficiency, improve the time complexity from O(N) to O(logN))
  • How about redis master-slave mechanism? How do you do that?
  • Any GC tuning experience? (It’s a little vague, not a very good answer)
  • Do you have any questions?

On three sides

  • Let me introduce myself briefly
  • How does the monitoring system work, which modules are there, and how do they interact with each other? What database are you using? (MySQL) what storage engine is used, why InnnoDB? (Support for transactions, clustered indexes, MVCC)
  • Is the order sheet split? How? (Vertical split and horizontal split)
  • After horizontal split query process description
  • What if the data that falls on a shard is large? (Divide a single table into multiple tables according to certain rules, such as hashing modulus, range)
  • Is there a problem with hashing modules? (Yes, uneven data distribution, relatively complex capacity expansion and reduction)
  • How to solve the reading and writing pressure after dividing the database and table? (One master has many followers, many masters have many followers)
  • How can primary keys be unique after splitting? (UUID, Snowflake algorithm)
  • Is Snowflake’s generated ID globally incremented unique? (No, only globally unique, single-machine incremental)
  • How to implement globally increasing unique IDS? (Talk about TDDL take a batch of IDS at a time, and then slowly allocate the local practice)
  • Mysql > select * from ‘B’; Mysql > select * from ‘B’; Mysql > select * from ‘B’;
  • A primary key index contains a row and a leaf index contains a primary key ID. A leaf index contains a primary key ID and a leaf index contains a primary key ID. (Not necessarily, if the query field happens to be an index field or part of the index, you do not need to return to the table, which is also the principle of index overwrite.)
  • What are the current bottlenecks in your system?
  • How are you going to optimize? Briefly describe your optimization ideas
  • Is there anything you want to ask me?

All around

  • Introduce yourself
  • Why do it backwards?
  • How to understand microservices?
  • How is service governance implemented? (Said the realization of current limiting, pressure measuring, monitoring and other modules)
  • Isn’t that what middleware does? Why does your department do it? (There was no separate middleware team at the time, microservices were new and needed monitoring and performance tuning)
  • Let’s talk about the Spring lifecycle
  • The young AND Full GC trigger conditions and the collection process as well as the object creation process.
  • What’s wrong with the CMS GC? (Concurrent cleanup algorithm, floating garbage, short pause)
  • How to avoid floating garbage? Remember that there is a VM parameter setting that allows a young GC to be performed before the new generation is scanned, but since gc is automatically scheduled by the virtual machine, it is not guaranteed to be performed. But there are also parameters that allow the virtual machine to force a Young GC.)
  • What’s the problem with forcing young GC? (STW pauses longer)
  • Do you know G1? (Know a little)
  • What is the recycling process like? (Young GC, concurrent GC, mixed GC, full GC, Remember Set)
  • How is the underlying implementation of Remember Set you mentioned?
  • Do you have any questions?

Five surface

The fifth was the HRBP interview. I made an appointment with him in advance, and he mainly talked about his previous internship experience in ant, what he was doing in the department, career development, and welfare benefits. Ali: Interviewers do have veto power. They value your values and generally prefer honest candidates. HR must be honest, do not lie, as long as you lie HR will confirm, cut directly.

  • Why don’t ants stay after three months of practice?
  • Who was the supervisor during the internship?
  • What did the internship do? (What the hell?)
  • What do you think about technology? What technology stack do you usually use? (Ali HR really is both father and mother,)
  • Have you been working on anything lately
  • What do you think of SRE
  • Do you have any salary expectations

Finally, HR also told me that there was a shortage of staff in the Stability Guarantee Department at present, and hoped that I could reply as soon as possible.

summary

Ant interviews pay more attention to the foundation, so Java those basic skills must be solid. Ant’s working environment is quite good, because I am in the stability assurance department, there are many separate groups, what three years 1 class, very youthful feeling. The basic level of the interviewers is relatively high, most of them are ABOVE P7, in addition to the basic but also asked a lot of questions about architecture design, the harvest is quite big.

A lot of spelling

  • Before the interview
  • One side
  • Second interview
  • On three sides
  • summary

Before the interview

After eating the ants, I heard about pinduoduo, the unicorn, and decided to eat the ants too. First of all, I found a Pinduoduo HR in Maimai, added wechat to chat, and sent my resume to start my pinduoduo interview journey. I would like to thank pinduoduo HR for helping me from the interview to the offer confirmation. She is really nice.

One side

  • Why did the ants only stay for three months? No confirmation? (Full time, explained a bit…)
  • Java HashMap, TreeMap (TreeMap red-black tree, ordered, HashMap unordered, array + linked list)
  • What is the time complexity of TreeMap query writes? (O(logN))
  • What’s wrong with HashMap multithreading? (thread safety, deadlocks) how to solve? In jdk1.8, synchronize + CAS is used for capacity expansion. If yes, the CAS checks for modification and retry. CAS (Compare And Swap) does not block threads, but since retries are performed by spin, they still take up CPU time, And ABA issues. If the number of spins exceeds a timeout, the number of spins is specified by AtomicStampedReference (ABA). If the number of spins exceeds a timeout, the number of spins is still failed. (Synchronize mutex)
  • What is the difference between CAS and Synchronize? Why don’t they all use Synchronize? CAS is optimistic locking, does not require blocking, hardware-level implementation of atomicity; Synchronize blocks atomicity at the JVM level. When a thread conflict is serious, CAS causes a high CPU pressure and a drop in throughput. Synchronize starts spinning and then blocks. When a thread conflict is serious, high throughput still occurs because the threads are blocked and do not consume the CPU.
  • What if you want to be thread safe? (ConcurrentHashMap)
  • How is ConcurrentHashMap thread safe? (Segmental lock)
  • Do I need to lock get? Why? (No, volatile keyword)
  • What does volatile do? (Ensure memory visibility)
  • How is it implemented at the bottom? (Talking about main memory and working memory, read-write memory barriers, happen-before, and drawing thread interaction diagrams on paper)
  • How is visibility guaranteed on a multi-core CPU? (Think for a moment, bus sniffing technology)
  • How do systems interact with each other?
  • How many concurrent systems and how to optimize?
  • Give me a piece of paper, draw a nine squares, fill in the numbers, give me a MN matrix, and print the number of MN counterclockwise from 1, requiring the time complexity to be as low as possible.
  • You can start with your thoughts (remember, said when to change direction conditions, right, down, left, up, and so on)
  • Is there anything you want to ask me?

Second interview

  • Let me introduce myself
  • Do you have any other offers? (Got the offer from ants)
  • What is the organizational structure of the department? (This round is not technical, but still honest)
  • What modules does the system have? What technologies does each module use? How does the data flow? I was given a piece of paper on which I sketched the flow between systems
  • How is the link tracing information transmitted? RpcContext attachment :parentSpanId + curSpanId
  • How does SpanId guarantee uniqueness? (UUID, talk about internal customization changes)
  • In what dimension is RpcContext passed? (thread)
  • How is the remote call to Dubbo implemented? Read configuration, assemble URL, create Invoker, service export, service registration, dynamic proxy, filter, get Invoker list, load balancing, etc.
  • How are Spring singletons implemented? (Singleton registry)
  • Why implement a separate service governance framework? (Said that the internal micro service just started, mainly for some monitoring and performance optimization of the service)
  • Who is in charge? Is the interior still in use?
  • Have you ever thought about how to make it universal?
  • Do you have any questions?

On three sides

After the second interview with the boss, I went to HR directly, mainly asking about career development, whether there are other offers, as well as the intention of entry and other questions. Besides, I also mentioned the company’s welfare benefits, which were quite routine. However, it should be said that other offers or big factory experience will be a certain plus.

summary

The interview process of Pinduoduo 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, so long as the foundation is solid, it should not be a problem. However, I have to say that the work is very intense. HR confirmed with me in advance whether I could accept such intense work before the interview. If you want to be old, you still need to be prepared

Bytes to beat

  • Before the interview
  • One side
  • Second interview
  • summary

Before the interview

The toutiao interview is the most professional among the three. A special HR staff will make an appointment with you before each interview, and you will have an interview after confirming that it is OK. Every time I interviewed by video, it was a little bit unnatural because it was always on the phone or in person. Some people like the video interview experience, but not everyone likes it. The most pit of the second face when the other interviewer’s network is always out of line, the last very undeserved hang (of course, some points are not good answer is also one of the reasons). So it’s a bit of a shame.

One side

  • Let me introduce myself first
  • Talking about projects, what do you mean reverse systems
  • Talk about the project, what technologies were used in the reverse system
  • How to determine the number of threads in the thread pool?
  • How can I determine if I/O operation is the main operation?
  • How do you know if you’re doing computations?
  • Are you familiar with Redis? What data structures do you know? (Zset) How is zset implemented? (jump)
  • What is the query process of the hop table, query and insert time complexity? Write and insert time complexity is O(logN).
  • Red black trees? Time complexity? (N cross balanced tree, O(logN))
  • Since the time complexity of the two data structures is O(logN), why not use red black tree (jump table is simple to implement, low cost to step on the pit, red black tree must be rotated to maintain balance every time insert, achieve complex)
  • Nodding your head, how does Dubbo work? Did you step into any holes? (Dubbo exception handling and print accesslog issues)
  • Does CAS know? (Talking about CAS implementation) Any other synchronization mechanisms? (Synchronize and the difference between the two, an optimistic lock and a pessimistic lock)
  • So let’s do A problem, 2 times n elements in array A, n odd numbers, n even numbers, and design an algorithm so that the indices of an array that has an odd number are all odd, and the indices of an even number are all even
  • If it’s an odd number, skip it. If it’s an odd number, skip it. If it’s not, find the next odd number.
  • The next odd number? How to find? (A little confused, thinking…)
  • Any ideas? If the subscript property does not match the element at that position, then replace it with the next element in the array.
  • If you want O(N), what do you do? (Think for a moment, and answer: “Define two Pointers, starting with the indices 0 and 1, and stop when the odd bit is even and the even bit is odd, and swap.”)
  • I’m almost out of time. Let’s stop there. What do you want to ask me?

Second interview

  • The interviewer is much nicer, so you can introduce yourself first
  • What is your understanding of service governance?
  • How is flow limiting implemented in the project? (Guava Ratelimiter, token bucket algorithm)
  • How does it work? (Key points are fixed rate and limited number of tokens)
  • What’s the problem if all of a sudden many threads are requesting tokens at the same time? (Many requests are backlogged and threads are blocked)
  • How do you solve it? (You can put backlogged requests on a message queue and process them asynchronously)
  • What if you don’t use message queues? (RateLimiter’s pre-purchase strategy)
  • How is the context of distributed tracing stored and passed? (ThreadLocal + spanId, where the spanId of the current node acts as the parent spanId of the next node)
  • How is Dubbo’s RpcContext passed? How is the main thread ThreadLocal passed to the thread pool? Create a new ThreadLocal in the thread pool and set the context information to the ThreadLocal. The ThreadLocal created by the thread pool must be removed manually in finally, otherwise there will be memory leaks.
  • What exactly is causing the memory leak you are talking about? The main thread still has a reference to a ThreadLocal, and the main thread does not have a reference to a ThreadLocal. In the first scenario, since the main thread is still running, there are still references to ThreadLocal, and the references and values of ThreadLocal variables are not recycled. In the second scenario, although the main thread does not have a reference to ThreadLocal and the reference is weak, it will be reclaimed during GC, but the value used is not weak and will not be reclaimed, still causing a memory leak.)
  • Do threads in the thread pool have to manually remove a value? (Yes, since the core thread of the thread pool is always present, if not cleaned, then the threadLocals variable of the core thread will always hold the ThreadLocal variable.)
  • Do you mean the main thread or the thread pool? (Main thread)
  • But since the main thread exits, shouldn’t referenced objects be recycled? (Interviewer and memory leak on the bar), silence for a while…
  • How do you make SpringMVC thread safe with different user logins? (Just explain a little meng force, did not react, incredibly answered into a lock. It’s been an hour, and it’s not good…)
  • ThreadLocal can be used directly. Have you seen the code for SpringMVC to implement locking? (A little dizzy…)
  • Let’s talk about mysql and index structure (B+ tree).
  • Why use B+ trees? (High query efficiency, O(logN), can make full use of disk prefetch features, multi-fork tree, small depth, leaf nodes in order and storage data)
  • What is index coverage? (Forget…)
  • Why did Java design the parental delegation model?
  • When do I need a custom class loader?
  • Let’s do a problem, hand write an object pool
  • Is there anything you want to ask me? (I feel like I missed a lot of points, did I hang up?)

summary

The headline interview is really professional. Each time the interviewer will send you a link to the video in advance, and then start the interview on time.

Interviewers have a tendency to latch on to a point that’s worth digging into or that you didn’t get across until you get it across, or they’ll feel like you didn’t really get it. In the second interview, the interviewer gave me some advice: when researching technologies, I must study the background and figure out what specific problems to solve in what scenes. In fact, many technologies are interlinked internally. Very sincere, but thank you very much to the interviewer.

conclusion

From the beginning of the interview to the headline about a month, I really feel a little exhausted. Finally, I got the offer of Pinduoduo and Ant, which was quite lucky. The headline interview helped me a lot. Thank you again for the sincere advice of the interviewer and the detailed answers of HR for my long-worded questions.

The idea here is to do two things before the interview: your resume and your introduction. Take a good look at some of your projects and pick a few highlights. Self-introduction is almost every round of interview, so it is best to practice in advance, decide what to say, how to say it. In addition, the technology mentioned in the resume must be their own in-depth research, no in-depth research is also best to find some information under preheating, do not fight unprepared.

Recommended Reading

“Spring Combat”, “Zookeeper”, “High-performance MySQL”, “Hundred-million-level Website Architecture Core Technology”, “Java Program Performance Optimization”, “Java Programming Ideas”, “Alibaba Java Development Manual”

Electronic version of books (collation of practical books, free of charge)

Please forward it and add assistant VX: Yunduoa2019 after following it or scan the qr code below and follow the guidance of the assistant to obtain it by yourself

Big factory interview answer collation

Please forward it and add assistant VX: Yunduoa2019 after following it or scan the qr code below and follow the guidance of the assistant to obtain it by yourself

Interview Documents (Java Core Knowledge)

Please forward it and add assistant VX: Yunduoa2019 after following it or scan the qr code below and follow the guidance of the assistant to obtain it by yourself