Some time ago, something happened at home , Quit and go home for a while , After dealing with my hometown, I will go back to Guangzhou and continue to look for work , Maybe a few days before National Day, I went to interview a family called Bigo(YY Subsidiary company ), The interview position is for 3-5 Year of Java Development , Finally, I fell on the technical side of the third round . Although there are some regrets and frustrations , But I think it's better to write a blog to record my interview process , It is also the sharing of the vast majority of programmers , I hope it will be helpful for your future study and interview .

Personal situation

First say LZ Personal situation of .

17 Years of graduation , Two copies , Currently located in Guangzhou , It's a very common Java Developers , I have more than two years of development experience .

In fact, this stage is a bit awkward , be unable to achieve one's heart's desire but unwilling to accept less , A little better than a junior programmer , But not to the advanced level . Plus now IT The industry is close to saturation , Many jobs require at least 3-5 More than years of development experience , So the demand for two years or so of development experience is actually relatively small , This is in LZ I have deep experience in the process of looking for a job . The most sad thing is , This year's environment is not good , A lot of companies are laying off workers , Let alone recruitment , The cruel situation is even worse for job seekers , I believe that many students who are looking for jobs also have some experience . therefore , Under the last resort , It's recommended that you don't talk naked !

Bigo interview

Interview position :Java The background and development

Experience requirements :3-5 year

Because it's national day to interview Bigo Of , It's more than a month now , Although there is still an impression , But there are many interview questions that have been forgotten , So I can only describe the interview process according to my own memory , If you don't understand, please forgive me !

one side ( Wechat phone )

bigo The first one is wechat phone interview , I wanted to call directly , But the interviewer said he needed to write algorithm questions , Change it to wechat phone .

  • Self introduction.

  • So let's see Java Foundation , What are memory leaks and memory overflows ?( Overflow means that too many objects are created, resulting in insufficient memory space , Leak is useless object not recovered )

  • JVM How to judge the object is useless ?( Root search algorithm , from GC Root set out , Object does not reference , It's a useless object )

  • Which objects can the root node be in the root search algorithm ?( Class object , Object of virtual machine stack , Objects referenced by constants )

  • The difference between overloading and rewriting ?( Overload occurs in the same class , Same method name , Different parameter list ; Rewriting is the behavior between parent and child classes , Method name and parameter list are the same , Methods the internal procedure is different )

  • There are no restrictions on rewriting ?

  • Java What synchronization tools are available ?(synchronized and Lock)

  • What's the difference between the two ( I've written a comparison of the two before , According to the above knowledge points, I will talk about the following , Article address :Java Concurrent programming :synchronized、Lock、ReentrantLock as well as ReadWriteLock The things about  )

  • ArrayList and LinkedList The difference between ?(ArrayList Based on the array , Search fast , Slow addition and deletion of elements ,LinkedList Based on the list , Additions and deletions quickly , Search is inefficient because it traverses elements )

  • Which of these two sets takes up memory ?( It depends on the situation ,ArrayList If there is expansion and the elements are not full of the array , There is a lot of wasted memory space , But in general ,LinkedList It takes up a lot of memory , Because each element contains a pointer to the front and back nodes )

  • The way HashMap Bottom structure of ( Array + Linked list , The list is too long to be a red black tree )

  • HashMap Why thread is not safe ,1.7 Before the release HashMap What's the problem? ( Multithreading operation during capacity expansion may lead to chaining of linked lists , And then call get The method will be endless )

  • understand ConcurrentHashMap Do you ? Say why it's thread safe ( With the sectional lock )

  • Which methods need to lock the whole set ?( Read size When )

  • Look at your resume. It says that you understand RPC ah , Then you say RPC The whole process ?( Request from client , To socket transmission , Then the server processes the message , And how to serialize it )

  • After the server obtains the interface information to be called by the client , How to find the corresponding implementation class ?( Reflection + Comment , I don't know much about it )

  • dubbo There are several load balancing algorithms ?( Random , polling , Minimum number of active requests , Uniformity hash)

  • What do you mean by the least active number algorithm ?( The service provider has a counter , Record the current number of simultaneous requests , The value indicates that the server load is smaller , The router will choose the server first )

  • How does the server know the algorithm to be called by the client ?(socket The algorithm strategy will be passed to the server when the message is delivered )

  • You used redis Do distributed locks, right , Do you write your own tool class ?( No , We use it redission Do distributed locks )

  • The thread gets key How can I guarantee that I won't be locked ?( Here it is key Add an expiration date )

  • If the expiration time is up , But the business process is not finished , What should I do ?( forehead ...... You can guarantee idempotence in business logic )

  • If multiple businesses use distributed locks , Every business has to be idempotent , Is there a better way ?( forehead ...... I have no clue after thinking about it , The interviewer said to skip first . I learned afterwards that redission It's a watchdog thread , If detected key If held, the expiration time will be reset again )

  • You have paper and pen over there , Write an algorithm , Use two stacks to simulate the entry and exit of a queue .( Because I was impressed with this question when I reviewed it before , It's also faster to write , It took about five minutes , Then I took a picture and sent it to the interviewer , After the other side read it, they said they had no problem and ended the interview .)

The first question is not difficult , The problems are all partial basis and so on , Although the answer is not perfect , But the process was relatively smooth . After a few days ,Bigo Of hr Invite me to their company for an on-site interview .

Two sides

To Bigo After the company , a hr My little sister entertained me to a meeting room , I waited about half an hour , A middle-aged man came in , Very polite , Sorry to have kept me waiting so long , And introduced myself as a technical manager , And then we started talking .

  • By convention , Let me introduce myself briefly , In the process, he is also reading my resume .

  • Talk about your most familiar projects .( I'll start with an e-commerce project recently done by my last company , From a simple project description , To the main functions of the project , And the functional modules I'm mainly responsible for , Right! Right ..............)

  • You are so familiar with the project , Then draw your project architecture according to your understanding , What part did you participate in .( The subject is still rather troublesome , After all, I left for a long time , The architecture of this project is also a little vague . Of course , At last, I drew a rough picture , Access from the front end , And then through nginx Gateway layer , Finally to specific services and so on , And the service modules that I participated in are also marked out )

  • Your project uses Spring Cloud GateWay, Now that you have nginx It's a gateway , Why use gateWay Well ?(nginx It's load balancing , There are also gateways for client access ,gateWay It's a gateway to the service layer , And it's integrated with fuses Hystrix)

  • Fuse Hystrix What's the main role ?( Prevent service avalanche caused by service call failure , Can degrade )

  • Your project uses redis, Yours redis How it was deployed ?( forehead .... It seems to be deployed in sentinel mode .)

  • Let's talk about your understanding of sentinel mode ?( I don't know much about sentinel mode , I'll say something about it Sentinel Monitoring and so on , There are also similar ping Command heartbeat mechanism , And how to judge a master It's offline and so on .....)

  • Then why do you use sentinel mode ? Why not deploy in a cluster way ? In limine get Less than his point , In other words, sentinels are deployed in multiple instances , He explained , That's right redis-cluster The deployment plan of .( forehead ......redis The environment is set up with special operation and maintenance personnel , High availability should be a priority .......... It's starting to get a little flustered , Because I don't know why )

  • Oh , Do you think that clusters can't achieve high availability ?( No .... Is not! , Just think sentinel mode may be more secure for master-slave replication ........ I don't know what I'm talking about )

  • Clustering also ensures high availability , Do you know how it ensures the consistency between the master and the slave ?( ok , I really don't know , Can only skip )

  • You must have wechat , If you want to design wechat circle of friends , How would you design its attribute members ?( Um. ...... Need to have a user table , The watch of the circle of friends , Friends list and so on )

  • Um. , good , You also know that wechat users are close to 10 Hundreds of millions of , It must involve sub database and sub table , If it's you , How to design sub database and sub table ?( The point of investigation of this problem is relatively large , What I answered is actually average , And in this process, the interviewer keeps asking questions , This leads to the topic being said almost 20 minute , Limited to space , I won't go into details here )

  • It's almost here , Finally, you write an algorithm , There is a set of unsorted integer arrays , You design an algorithm , Pair the elements of an array , Then output the maximum absolute value difference and the minimum absolute value difference " logarithm ".

    ( Listen to the question , My first thought is to use HashMap To preserve ,key It's the difference between the absolute values of two elements ,value It's the number of pairs , If you have the same, add 1, If it doesn't, it's assigned to 1, And then finally to map Sort , Maximum and minimum output value value , After writing, the interviewer said that although the result is correct , But it's not efficient , Because the time complexity of traversal becomes O(n2), Then remind me to think about sorting . I have an idea , You can sort the array first , Then the first element and the second element do the absolute value difference , Write it down as num, Then the first element loop and the following elements do the calculation , Until the difference in absolute value is not equal to num Location , It's more efficient than O(n2) It's much faster .)

After the interview , The technical officer asked me if I had anything to ask him , I asked about the responsibilities of this position and the technology stack used in the project , Then let me wait , Wait for him to inform the technical officer in three directions . Tell the truth , I feel the most comfortable on both sides , Because the interviewer is very kind , The interview process has been actively guiding me , And gave me a lot of advice on career planning , I benefited a lot , Although the interview time is one and a half hours , But it doesn't feel long at all , The whole interview was very comfortable , But for a long time , I can't remember many problems .

On three sides

Half an hour after the end of two sides , Three technical interviewers began to come in , From the distribution of his forehead and hair, we can guess that he is a big ox , People don't talk too much , I didn't introduce myself after I sat down , Ask directly , I didn't answer well in the whole process , And the interviewer's questions are not clear , Often need to confirm with him clearly .

  • Do you know anything about the business ? Let's talk about the isolation levels of transactions ( I know more about Spring Come on , hold Spring All four transaction isolation levels of are described )

  • You've done e-commerce , You should know that you need to reduce your inventory when you place an order, right , Let's say there are two services A and B, Operate the order and inventory table respectively ,A After saving the order , call B Failed to reduce inventory , This is the time A And roll back. , How to design this business ?(B Service inventory reduction method does not throw exceptions , By the caller, that is A Service throws exceptions )

  • Do you know the separation of reading and writing ?( forehead ... Get to know something about , It means entering the main library when writing , Read from the library )

  • When you say read from the library , Now suppose there is a table User I did a read/write separation , And then there's a thread in Within the scope of a transaction Yes User The watch is written first , Then I did the reading process , At this time, the data has not been synchronized to the slave database , How to ensure that you can read the latest data when reading ?( After listening, I felt a little confused , I can't answer for a while , Later, the interviewer said to find a way to ensure that the reading and writing in a transaction are the same library )

  • You used... In your project rabbitmq, Then you say mq How to deal with the consumer side of ?( After the consumer receives the message , Will first save the message to the database , Then run the message from the database regularly )

  • That is to say, your mq Save it to the database first , Then the business logic is from mq Read the message and then process it ?( Yes )

  • Is your message the only one ?( Yes , With the only constraint )

  • How can you guarantee that the news will be consumed ? Or how to ensure that it can be stored in the database ?( It's starting to panic here , because mq I've only seen part of the logic for accessing that part , But not in person , By right of oneself mq The answer is , It should depend on rabbitmq Of ack Acknowledgement mechanism )

  • good , Then you need to sort out the whole processing logic of your consumer end , Then talk about your ack Where did you go back ( Hearing this, my heart cooled ,mq I did not participate in this part of access , I drew a process according to my own understanding , But there are many holes )

  • According to your drawing , If the database goes down suddenly , How can you confirm that your message has been received ?( forehead ..... It's OK to store messages when sending them ......... Answer when the heart ten million grass mud road crossing ........ Come on , No play no more .)

  • What if the sender's service is multiple deployments ? When you save messages, the database always reports unique errors ?( ok , You win ... In the end, I stifled a sentence , What you are talking about is , This design is really not good ....)

  • Forget it , Skip it , Now you design a map, Then there are two threads for this map To operate , High speed increase and deletion of main thread map The elements of , Then there is an asynchronous thread to delete at a certain time map Main thread in 5 Data not deleted in seconds , How would you design ?

    ( I didn't answer the question well , After doing some simple thinking, we can put map Of key Mark with a time stamp , Traversal found less than the current timestamp 5 Seconds ago, the elements were deleted , The interviewer was obviously not satisfied with the answer , Say this traversal will affect efficiency ,ps: To this question , If you have any opinions, you can talk about it in the comment area !)

...... There are other questions , But I only remember so much , be it so .

After finishing the last question , The interviewer said that the interview process was over , Let me go back and wait for the news . I heard that , I know it's basically a declaration of results . remember , This round of interview really performed in a very general way , Plus it's a long time , From the 2 Half past three until the interview 6 Some more , I'm also mentally exhausted . Sure enough , After a few days ,hr Wechat informed me , Say I didn't pass the third round of technical interview , This interview ended in failure .


That's the general process of the interview , Have to say , The interview of big factory is very technical , I learned a lot in the process , Here are some personal experiences :

1、 Basics Basics Basics ! Important things are to be repeated for 3 times , No matter what stage of programmer , The foundation is the most important . Every company's interview must involve basic knowledge questions , If you don't have a solid foundation , Often the first side can be eliminated .

2、 Resumes need to be properly packaged . honestly , My resume must have been packaged , It's also because I haven't had enough years of work , But we can get Bigo An important reason for an interview , So it's necessary to pack your resume properly , But remember a little , Namely Can't be divorced from reality , For example, Mingming has only two years of experience , But it was written for three years . Small factories may muddle through , But big factories are very difficult , Because many companies do background checks before they start .

3、 Be familiar with the technical points on your resume . Resume packing is OK , But be familiar with the technical points on your resume , For example, I just wrote about it rabbitmq Of demo Words , Don't write “ be familiar with ” Equal word , Because many interviewers will ask in-depth questions about a skill point , Cultivate your understanding of this skill point like a series of cannons .

4、 The items on your resume should be very familiar with . Generally, we need to package and beautify our own projects when we write resumes , A good project can add a lot of points to your resume . But be very familiar with the project , It is better not to write unfamiliar modules . I have suffered a great loss this time , I have an e-commerce project on my resume rabbitmq Deal with orders , Although I have a little understanding of the processing logic of that part of the order , But because I didn't participate in it myself, I didn't have a deep understanding , During the interview, I was Bigo The interviewer in three faces was finally speechless .

5、 Improve your own architectural thinking . For junior and intermediate programmers , The daily work is to add, delete, modify, and search , The realization of the function is over , This kind of thinking can't be said badly , Just want to go one step further , Business time needs to improve their own thinking ability of architecture , For example, if you take over a project , How would you consider designing this project , From the overall structure , To introduce some components , Then to design specific business services , These are the links that must be considered when designing a project , It's a good exercise to improve our architectural thinking , This is also an important part of the interview for senior programmers in many large factories .

6、 Don't be naked . This is also my most simple suggestion , Bad environment , Cherish it , alas ~~~~

in general , This interview Bigo It's still a very fruitful , Although it's a little pity , But there's nothing to regret , After all, I was well prepared before the interview , Some of the questions are not well answered, which shows that I have many technical blind spots , Don't understand is don't understand , It can't be blown out again . This is also a wake-up call for me , You're still tender , Cultivate your internal skill , After all, food is the original sin .