Gold three silver four seasons of job hopping, BATJ and other major Java companies, finally enter the byte

In the past few months, several major factories have received offers, and finally went to ByteDance. Overall feeling:

  1. Every major factory asks questions in particular detail. Although the following interviews are summarized in one sentence, in the actual interview process, the project accounted for a large part of the entire interview process. On the contrary, it is purely technical. The proportions are relatively small.
  2. The interview questions are almost similar, relatively simple, and very common. (Reference analysis at the end of the article)

 

 

Meituan

Usually there are two rounds of technical interviews, one round of HR interviews, there will be an algorithm question on the first side, and sometimes there will be three rounds of technical interviews.

one side

  • An algorithm question, about ten minutes, requires normal operation and passes the given test case.
  • What are the difficulties of the most challenging project you have done recently?
  • Talk about the design of the system in conjunction with the project, and ask questions based on your design.
  • How do you ensure data consistency in your project?
  • When the code executes the SQL statement, the database connection has a timeout exception, but you don't know if the SQL statement is executed successfully in the database. How to ensure data consistency in this case?
  • How are distributed locks implemented in your system? (At that time, the answer was realized by redis, set(key,value,nx,ex,expire))
  • What are the problems with using redis to implement distributed locks above?
  • In addition to using redis to implement distributed locks in the project, what other usage scenarios are there?
  • Redis's data persistence mechanism? How to ensure that data is not lost? When the redis memory is full, what is the memory elimination strategy?
  • How does AQS implement locks? The difference with synchronize
  • What is the difference between MySQL storage engine? What are the isolation levels of the database?
  • What is the data structure of the MySQL index? Why choose this data structure?
  • What is the difference between B+Tree and B-Tree?
  • What are the Reactor threading models? How does Netty support these three threading models?
  • How is the multiplexer implemented?
  • The realization principle of epoll? The difference between epoll, poll, select
  • How does the JVM perform garbage collection? What are the marking algorithms? What are the garbage collection algorithms?
  • The principle of CMS garbage collector?

Two sides

  • The most challenging project you have done recently?
  • Double write consistency between redis and MySQL? How did you do it? Why did you do this? What are the problems with other practices?
  • The realization principle of distributed lock
  • What are the isolation levels of the database? What problems do these isolation levels solve?
  • How does MySQL solve the problem of non-repeatable reads?
  • The realization principle of MVCC
  • Is there a phantom read under the repeatable read isolation level of MySQL? why?
  • Are database indexes created as many as possible? why? How many are usually created?
  • A table has established indexes for the three fields of a, b, and c. Now there is a SQL statement: select field1, field2 ... from t where a = xx and b=xx and c=xx. Will this SQL statement be Is the index used? If so, which index will be used? (Answer: Only one of the indexes will be used, which may be a, b, or c. Which index is used is related to the data in the table)
  • Why not use the three indexes of a, b, and c at the same time? What is back to the table?
  • The difference between clustered index and non-clustered index
  • How to know which indexes are used in a SQL statement? (Answer: Use explain to view)
  • What are the columns of the explain result? What do they mean?
  • How to view slow SQL?
  • When multiple SQL statements are executed in a Spring transaction, does it correspond to multiple database connections or one database connection? (Answer: One connection, multiple transactions cannot be guaranteed)
  • Since it is a connection, how does Spring ensure that the current thread gets the same connection when executing multiple SQLs before and after? (Answer: I didn’t expect ThreadLocal at the time. The interviewer said that if it were you, how would it be implemented. Later, I replied that there is a map, the key is the current thread, and the value is the database connection. At the end of the day, I thought of ThreadLocal)
  • How does ThreadLocal work?
  • What issues should be paid attention to when using ThreadLocal? (In fact, it is asking about the memory leak of ThreadLocal)
  • Principle of Redis master-slave replication
  • What has MQ used? How to choose?
  • What RPC framework is used? Why choose it?
  • The online service traffic is soaring, what should I do, and the detailed process? Adding a new service node may also cause the machine to be blown up before the service is up. What should I do at this time?
  • A scenario question: There are now 10 million merchants who know their geographic location. When we enter the APP homepage, how to load nearby businesses?
  • career planning? Why choose to quit before the end of the year?

 

 

byte

Three rounds of technical interviews, one round of HR interviews, each round of technical interviews will have at least one algorithm question.

one side

  • An algorithm problem
  • Chat project, how is your advertising search engine designed? Why don't you use search components like ElasticSearch for your ad search?
  • What are the locks in Java? The difference with Lock
  • The underlying realization principle of synchronized?
  • The realization principle of AQS?
  • The role and implementation principle of volatile?
  • JVM's garbage collection algorithm
  • What are GC Roots?
  • Briefly describe the difference between the new generation and the old generation?
  • The loading process of the class? What is the parent delegation mechanism?
  • The realization principle of thread pool? The thread pool is full, what will happen when the task is submitted again?
  • How does redis implement distributed locks? What's wrong with redis distributed lock? Are you familiar with lua scripts?
  • What is the expiration strategy for keys in redis?
  • The persistence mechanism of redis? The difference between AOF and RDB?
  • What is cache breakdown, cache penetration, and cache avalanche? How to deal with it?
  • The realization principle of MySQL database index?
  • What is back to the table? What is a joint index? What is the leftmost prefix matching principle?
  • How does MySQL ensure high availability? Principle of master-slave replication?
  • Use of the Explain keyword.
  • The realization principle of RocketMQ.
  • The selection of registration center?
  • How does Zookeeper act as a registry?
  • How does Zookeeper implement distributed locks?

Two sides

  • An algorithm problem
  • Talk in detail about project experience
  • How to solve the redis cache and database data consistency?
  • How to solve distributed transactions in a distributed system? (Answer: RocketMQ transaction message)
  • The realization principle of RocketMQ transaction message? How to ensure data consistency through RocketMQ in your project
  • Why does MySQL use B+ tree as index, and what are its advantages and disadvantages compared with B-tree?
  • What is a covering index?
  • What is the isolation level of transactions in MySQL?
  • SQL optimization experience?
  • Redis persistence mechanism? How to ensure that data is not lost?
  • Redis's memory elimination strategy? Key expiration strategy?
  • How does RocketMQ ensure reliable data transmission (data is not lost)?
  • There are a lot of messages accumulated in RocketMQ, what should I do?
  • Netty's threading model? Under the master-slave multithreading model, how are threads divided?
  • What is the realization principle of thread pool? How to set the parameters of the thread pool?
  • For a CPU-intensive system, why is the number of threads set to the number of CPU cores + 1? Why +1?
  • For IO-intensive systems, why the number of threads is twice the number of CPU cores? Why is it 2 times, not 3 times, 4 times, etc.?
  • Selection of RPC framework?
  • How does Motan achieve load balancing?
  • What is the next work plan? why?

Three sides

  • An algorithm problem
  • Do you understand this data structure? How to judge whether there is a ring in the graph?
  • How to find all the environments in the picture?
  • What is the difference between Http and Https?
  • TCP three handshake and four wave hands?
  • How does TCP guarantee reliable transmission?
  • What is the difference between BIO, NIO and AIO?
  • What do you know about encryption algorithms? What is symmetric encryption? What is asymmetric encryption?
  • How to ensure the security of the interface? What encryption strategy should be used?
  • Talk about the hash consensus algorithm?
  • The data structure and principle of MySQL index?
  • MySQL tuning experience
  • Technical selection of microservices? Why choose Motan?
  • Principle of RPC call

 

 

Tencent

Usually three rounds of technical interviews, one round of HR interviews, there will be an algorithm question in the first round of interviews, and sometimes there may be 4 rounds of technical interviews.

one side

On the one hand, it mainly asks basic and regular questions about Java. See the answers for comparison.

  • Is passing by value or by reference used in Java?
  • How are the input parameters passed when the method is called?
  • What data areas are there in the JVM?
  • What are the List collections? What are the differences and usage scenarios between ArrayList and LinkedList? why?
  • The realization principle of HashMap? What is the difference between 1.7 and 1.8?
  • The hash algorithm in HashMap? What are the benefits of such a hash algorithm (both high and low 16 bits are involved in the operation)? How to address?
  • What are the problems with using HashMap? (What's the difference between 1.7 and 1.8) How to solve it?
  • What are the thread-safe maps in Java?
  • The realization principle of ConcurrentHashMap? What is the difference between 1.7 and 1.8?
  • How does ConcurrentHashMap count the number of elements? What will be the problem?
  • What is the JMM memory model?
  • The realization principle of synchronized
  • The realization principle of thread pool? What are the parameters and what do they mean?
  • Garbage collection algorithm.
  • The basic principle of reflection in Java? How is reflection used in actual projects?
  • Which design patterns are you familiar with? Where have you actually used it in the project?
  • An algorithm problem

Two sides

The main topic is the project, and the technical issues are brought up when talking about the project.

  • The most fulfilling project you have done recently? What problems did you encounter in this project?
  • How to ensure data consistency in your distributed system? (Answer: The transaction message of RocketMQ is used to ensure final consistency. I will talk about the implementation principle of RocketMQ most of the time later)
  • How does the back end prevent repeated requests and ensure idempotence when the client requests it?
  • How to implement distributed locks?
  • What are the problems with redis implementing distributed locks?
  • redis distributed lock and lua script?
  • Did you know about redission? Talk about its realization principle?
  • Why use RocketMQ in the project? For MQ, how do you choose?
  • The realization principle of RocketMQ? How are the messages stored?
  • MQ missing message appears online? Where might the problem be? How to ensure that MQ messages are not lost?
  • How to ensure the high availability of RocketMQ?
  • The realization principle of RocketMQ transaction message?
  • How to ensure the order of messages?
  • How to ensure that messages are not re-consumed?
  • Your project involves transfer-related businesses, how do you ensure the accuracy and safety of funds?
  • Design a reconciliation system for your project.
  • How to ensure the strong consistency of the distributed system?

Three sides

It’s almost the same as on the second side. Most of the time we talk about projects and the questions are similar. Repeated interview questions will not be repeated

  • Talk about project experience
  • What problems did you encounter in the process of using redis? How to solve the hot key problem?
  • Which mode does your redis use? What is the difference between cluster mode and sentinel mode? How to ensure the high availability of redis cluster in cluster mode and sentinel mode? Redis cluster failover process?
  • The principle of the raft protocol?
  • JVM tuning experience?
  • What is a three-color mark?
  • Double-write consistency between database and cache?
  • Combining the project, how to design the sub-database and sub-table
  • The principle of MySQL master-slave replication?
  • The realization principle of ConcurrentHashMap?
  • How is the Node node in CucurrentHashMap designed? Why use final and volatile to modify the attributes of Node nodes? what's the effect?
  • Do you have any plans for your personal career?

All sides

  • Project experience
  • How is an object stored in the JVM?
  • The class loading process, and the process of method execution?
  • JVM's garbage collection mechanism? Why distinguish between the new generation and the old generation?
  • How to troubleshoot problems with online GC?
  • What are the usage scenarios of Spring's AOP? What are the benefits of the AOP mechanism?
  • Distributed transaction problem, CAP theory? 2PC, XA, TCC, MQ and other principles
  • Similar to systems like Taobao, how do you think they achieve strong data consistency?
  • How to expand the redis cluster?
  • The redis rehash process?
  • What are the threading models of Netty?
  • What are TCP bread and half packets? How does Netty solve it?
  • The principle of epoll?
  • TCP's three-way handshake and four waved hands? Why is it 3 times and 4 times?
  • How is your advertising search engine designed? What is the current flow? If it supports a larger amount of advertising
  • Why leave from the last company?

 

 

Ali

Three rounds of technical interviews, one round of HR interviews, the first round is usually a telephone interview, the second round is a video, and there may be an algorithm question.

one side

On the one hand, it is basically a basic Java problem, which is relatively simple.

  • How does Java determine whether an object can be recycled? What are the garbage collection algorithms?
  • What is the memory model?
  • What is thread safety?
  • What are the locks in Java? The difference between synchronize and Lock?
  • The underlying implementation principle of synchronize
  • The layout of the object in memory?
  • The realization principle of the volatile keyword?
  • What is atomicity, visibility, and order? What is the happen-before principle? Explain the semantics of final?
  • What is CAS? What's the problem with CAS?
  • The realization principle of Lock series lock?
  • What is an atomic class? The realization principle of atomic class?
  • What are the types of object references in Java?
  • How does ThreadLocal work? What's the problem? How to avoid it?
  • The realization principle of HashMap? What is the difference between 1.7 and 1.8?
  • What are the thread-safe Maps? The realization principle of ConcurrentHashMap? What is the difference between 1.7 and 1.8?
  • How does ConcurrentHashMap count the size?
  • Why is MySQL index B+Tree instead of data structure like array and Hash? Why not B-Tree?
  • What data types does Redis have? What if there are too many data in the list?
  • Redis's persistence mechanism? What are the advantages and disadvantages of AOF and RDB?
  • The online service interface is very slow? How to troubleshoot?

Two and three sides

The two sides and the three sides are on the same face. I can’t remember them clearly. It is probably these questions that interviewers prefer to ask.

  • An algorithm problem.
  • Talk about the project experience, very detailed.
  • What are the garbage marking algorithm and garbage collection algorithm?
  • What is a three-color mark? What are safe points and safe areas?
  • Briefly describe the principle of the G1 garbage collector?
  • Why did you not use the G1 garbage collector in your project?
  • When will Minor GC be triggered? When will we leave Old GC? What is Full GC?
  • When did the subject enter the old age? What is dynamic age judgment?
  • How big is the QPS of your online service? What is the machine configuration? How are the parameters of the JVM set? GC frequency? Why should this be configured like this?
  • Suppose the traffic of online services is 10,000 times the current traffic? What will happen to the system? How to optimize?
  • How to guarantee the high availability of Redis? How many machines are online? How is it deployed?
  • How does Redis implement distributed locks? What's the problem?
  • How to implement distributed locks with Zookeeper? What's the problem?
  • What problems can be caused by hot keys in Redis? How to find hot keys? How to solve the problem of hot keys?
  • What are the optimization experiences of SQL? The design guidelines of the index?
  • How to view the slow query log of SQL? How to deal with slow queries on online services?
  • What should I do if there is a deadlock in the online database?
  • How does MySQL's InnoDB solve the problem of non-repeatable reading and phantom reading in the repeatable read isolation field? What is snapshot read? What is the current reading?
  • What are the locks in MySQL? What is a gap lock?
  • What logs are there in MySQL?
  • What are the characteristics of the database? How does MySQL ensure that data will not be lost after the machine is down and restarted?
  • What does binlog do? What's the problem with formatting it as statement? How do you configure it online?
  • How to ensure the high availability of MySQL? The principle of master-slave replication?
  • Now in the online environment, it is found that the master node of MySQL is significantly behind the master node. What could be the reason? How to deal with it?
  • The selection of message queue? The realization principle of RocketMQ?
  • How to ensure that the message is not lost? How to ensure that messages are not re-consumed?
  • There is a large backlog of messages in online MQ, what should I do?
  • Let you design an MQ, how would you design it?
  • What is mmap?
  • Have you used netty? Why is netty a high-performance network framework?
  • How does the zero-copy mechanism work?
  • How to deploy Zookeeper cluster? How does Zookeeper implement elections? What is the ZAB agreement?
  • How does Zookeeper ensure the sequential consistency of data?
  • What is the usage scenario of Zookeeper? How to support a large number of read requests?
  • How do you select the registry for your microservices? What is the difference between Zookeeper and Eureka as the registry? What are their bottlenecks?
  • How to design a registry that can support a cluster of hundreds of thousands of machines?
  • How to design a spike system? On the day of Double Eleven, enter http://www.taobao.com from the browser   to load the page, and talk about its complete process.

Reference analysis

The answers to all the above questions have corresponding analytical documents for reference. There are also some similar interview questions summary articles on the Internet, but this editor is definitely one of the best, and you have time to find one by one on the Internet! Each knowledge point has a left-side navigation bookmark page, which is very convenient to read. Due to the large amount of content, here is a screenshot of some pictures. Readers and friends in need can

Click here to get it~​

 

 

Java basics

 

 

Java Collection Framework

 

 

jvm

 

 

Multithreading

 

 

The internet

 

 

Algorithm and data structure

 

 

Spring

 

 

Netty

 

 

Microservices/distributed

 

 

message queue

 

 

Distributed ID, other (gateway, current limit...)

 

 

MySQL

 

 

Redis

 

 

Summary of experience

These are some of the knowledge points that I have learned and summarized during work and interviews. They are some of the more typical questions that are often asked in interviews. If you don’t pay attention to summarizing , you may be confused when you are asked in an interview. Even if you know what the problem is, but you don’t sum it up carefully, you may be confused. Circumstance, and thus missed job opportunities.

Some knowledge points will be forgotten if I don’t use them often, but I will ask them during the interview. I also suffer a lot from this, so I decided to sort out the problems I encountered, share them, and help more people, so that we can make progress together. The so-called "revising the past and knowing the new ", if you look at this knowledge more when you are okay, you may have new gains. I will help you write everything you don’t have time to organize. For those in need, click here to receive it~

Guess you like

Origin blog.csdn.net/m0_46995061/article/details/114837325