Yu'ebao on the second side, successfully won the offer, and positioned Ali P8, must brush the interview questions 1,000,000 times

Interview questions that must be brushed in the gold three silver four interviews (must read articles)

one side

  • Self introduction
  • Monitoring in the project: What are the common monitoring indicators?
  • What are the technologies involved in microservices and the issues that need attention?
  • What do you know about the registration center?
  • Do you know the reliability of consul?
  • Have you ever gone deeper into the mechanism of consul? Have you compared it with other registration centers?
  • Many projects use Spring. Do you understand the principles of Spring? Principles of AOP and IOC
  • Apart from automatic configuration, what are the other differences between Spring Boot and traditional Spring?
  • How much do you know about Spring Cloud?
  • The life cycle of Spring Bean
  • What is the difference between HashMap and hashTable?
  • The hashcode method of Object has been rewritten. Should I change the equals method?
  • Hashmap thread unsafe occurrence scenarios
  • What should I do if the CPU of online services is high? What are the measures to find the problem
  • Which thread pools are there in the JDK? Incidentally, I talked about the thread pool
  • Try to avoid using the != or <> operator in the where clause, otherwise the engine will give up using the index and perform a full table scan
  • The order of SQL indexes, the order of fields
  • Check whether SQL uses an index? (What tools are there)
  • What is the difference between TCP and UDP? How to be reliable during TCP data transmission?
  • Tell me about the sorting algorithm you know
  • Find the median of an array?

Two sides

Do you have any questions for me? (Regular inquiry)

  • Self introduction, work experience, technology stack
  • What techniques did you learn in the project?
  • The granularity of microservice division?
  • How to ensure the high availability of microservices?
  • Load balancing and reverse proxy, isolation, current limit, downgrade, timeout and retry, rollback, stress test and emergency plan
  • Can you tell me how to use commonly used load balancing?

(Technical question)

  • http redirect
  • DNS load balancing
  • Reverse proxy load balancing
  • IP load balancing (LVS-NAT)
  • Direct routing (LVS-DR)
  • IP tunnel (LVS-TUN)
  • What benefits can a gateway bring to back-end services?
  • The life cycle of Spring Bean
  • How can the init and destroy methods configured in xml call specific methods? Mechanism of reflection
  • Methods in the Object class
  • Is the object comparison the same
  • How to judge whether the hashmap put method is duplicated
  • Object toString method is commonly used, why rewrite this method
  • What is the difference between Set and List?
  • The difference between ArrayList and LinkedList
  • If you access the same data, which one takes up more space between ArrayList and LinkedList?
  • Is the order in which Sets are stored?
  • What are the common implementations of Set?
  • What requirements does TreeSet have for data storage?
  • What about the underlying implementation of HashSet?
  • Have you seen the underlying source code of TreeSet?
  • Is HashSet thread safe? Why is it not thread safe?
  • What are the thread-safe maps in Java?
  • Do you know HashTable?
  • How to ensure thread safety issues?
  • synchronized、lock
  • The atomicity of volatile? Why does i++ not support atomicity? From the perspective of computer principle design, the reason why atomicity cannot be guaranteed happens before principle
  • cas operation
  • What is the difference between lock and synchronized?
  • Fair lock and unfair lock
  • Java read-write lock
  • What problem does the read-write lock design mainly solve?
  • In addition to writing Java code in your project, there is also front-end code. Do you know what frameworks are available for the front-end?
  • MySQL paging query statement
  • MySQL transaction characteristics and isolation level

Second, the concurrency of transactions

  • What scenarios will non-repeatable reading appear in?
  • Usage scenarios of sql having
  • What is the whole process of an http request from the front-end browser address to the back-end?
  • http default port, https default port
  • Do you know what DNS does?
  • What ide do you use for development? Can you tell me a few commonly used shortcut keys for idea?
  • What do you use for code version management?
  • What is the difference between git rebase and merge?

Does your company work a lot of overtime? (Off-topic)

Example answer:

Many projects use Spring. Do you understand the principles of Spring? Principles of AOP and IOC

Answer: (1). IoC (Inversion of Control) refers to the relationship between container control program objects, not in traditional implementation, which is directly controlled by program code. The control right is transferred from the application code to the external container, and the transfer of control right is the so-called reversal. For Spring, it is Spring that controls the life cycle of objects and the relationship between objects; IoC has another name-"Dependency Injection". From the name, the so-called dependency injection means that the dependency between components is determined by the container at runtime, that is, the container dynamically injects a certain dependency into the component.

(2). In Spring's working method, all classes will be registered in the spring container, telling spring what it is and what you need, and then spring will take the initiative when the system runs to the appropriate time To you, but also to other things that need you. The creation and destruction of all classes are controlled by spring, which means that it is no longer the object that references it, but spring that controls the life cycle of an object. For a specific object, it used to control other objects, but now all objects are controlled by spring, so this is called inversion of control.

(3). During the operation of the system, dynamically provide an object with other objects it needs.

(4). The idea of ​​dependency injection is realized through reflection mechanism. When a class is instantiated, it uses reflection to call the set method of the class to inject the class attributes stored in HashMap into the class. All in all, in the traditional method of object creation, the caller usually creates the instance of the callee, and the work of creating the callee in Spring is done by Spring, and then the caller is injected, which is the so-called dependency injection or control reaction. turn. There are two injection methods: dependency injection and setting injection; the advantages of IoC: reduce the coupling between components, reduce the complexity of replacement between business objects, and enable it to manage objects flexibly.

AOP(Aspect Oriented Programming)

(1). AOP aspect-oriented programming is based on IoC, which is a useful supplement to OOP;

(2). AOP uses a technology called "cross-cutting" to dissect the inside of the encapsulated object, and encapsulate those common behaviors that affect multiple classes into a reusable module, and name it "Aspect ", the aspect. The so-called "aspect", simply put, is to encapsulate the logic or responsibilities that are not related to the business but are commonly called by the business modules, such as log records, to reduce the duplication of the system code, reduce the coupling between modules, and have Conducive to future operability and maintainability.

(3). AOP represents a horizontal relationship, which compares the "object" to a hollow cylinder, which encapsulates the properties and behavior of the object; the method of aspect-oriented programming is to use this cylinder in the form of a section Dissected and selectively provide business logic. The cut-away section is the so-called "aspect". Then it restored these cut planes with ingenious skill, leaving no traces, but achieving the effect.

(4). The technology to achieve AOP is mainly divided into two categories: one is the use of dynamic proxy technology, which uses the method of intercepting messages to decorate the message to replace the execution of the original object behavior; the second is the use of static weaving In this way, a specific syntax is introduced to create "aspects", so that the compiler can weave code about "aspects" during compilation.

(5). Spring implements AOP: JDK dynamic proxy and CGLIB proxy JDK dynamic proxy: its proxy object must be the realization of an interface, which is to complete the proxy of the target object by creating an implementation class of the interface during operation; its The two core classes are InvocationHandler and Proxy. CGLIB proxy: The implementation principle is similar to the JDK dynamic proxy, except that the proxy object it generates during runtime is a subclass extended for the target class. CGLIB is an efficient code generation package. The bottom layer is implemented by ASM (open source java bytecode editing class library) to manipulate bytecode, and its performance is stronger than JDK; it needs to introduce packages asm.jar and cglib.jar. The aspects driven by AspectJ injection and @AspectJ annotations are actually implemented at the bottom level through dynamic agents.

(6). AOP usage scenarios:

  • Authentication permission check
  • Caching
  • Context passing
  • Error handling
  • Lazy loading
  • Debugging
  • logging, tracing, profiling and monitoring logging, tracking, optimization, calibration
  • Performance optimization performance optimization, efficiency check
  • Persistence
  • Resource pooling
  • Synchronization
  • Transaction management

In addition, the implementation of Filter and the implementation of struts2's interceptor are both the embodiment of AOP thought.

Yu'e Bao interview scene and interview answers (document summary)

2. Interview Yu'e Bao, win the offer, and locate Ali P8 smoothly, the interview questions must be rushed

 

At last

I have also collected a collection of Java interview core knowledge points to deal with the interview. I can take this opportunity to give it to my readers and friends for free:

table of Contents:

2. Interview Yu'e Bao, win the offer, and locate Ali P8 smoothly, the interview questions must be rushed

Java interview core knowledge points

There are a total of 30 topics, which are enough for readers and friends to cope with the interview, and it saves friends the time to search for information and organize themselves!

2. Interview Yu'e Bao, win the offer, and locate Ali P8 smoothly, the interview questions must be rushed

Java interview core knowledge points

How to receive the information: follow the forwarding and private message me [interview] to get it for free!

Some readers and friends have already got good offers by relying on this guide of Java interview knowledge points. Dear readers and friends, come and find me for free!

115 interviews with Dachang (Part 2)

2. Interview Yu'e Bao, win the offer, and locate Ali P8 smoothly, the interview questions must be rushed

 

A friend interviewed Ali, Bytedance, and finally got an offer from Bytedance based on this interview document from a big factory! ! !

How to receive the information: follow the forwarding and private message me [interview] to get it for free!

Guess you like

Origin blog.csdn.net/Java555222/article/details/108949938