New Year's sword refers to ants! Two-sided ants, I have already taken an offer if there is no danger, I have to say "too difficult"

Remember an ant programmer interview experience

 

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 gone deep 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
  • In addition to 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 emergence 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? By the way, I talked about the thread pool.
  • Should 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? The mechanism of reflection
  • Methods in the Object class
  • Is the object comparison the same
  • How to judge whether the hashmap put method is duplicated when storing
  • Object toString method is commonly used, why should it be rewritten
  • 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 with 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? In terms 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, you also have 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. Control is transferred from the application code to the external container, and the transfer of control 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". Understand from the name, the so-called dependency injection, that is, 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 the working method of Spring, 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 to do what you want when the system is running properly. 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 instantiating a class, 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, while 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 technique 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 ", that is, the aspect. The so-called "aspect", simply put, is to encapsulate the logic or responsibilities that are not related to the business but are called by the business modules, such as log records, which is convenient to reduce the duplication of the system code and reduce the coupling between modules. Conducive to future operability and maintainability.

(3). AOP represents a horizontal relationship. It 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 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 the message to decorate the message to replace the execution of the original object behavior; the other is the use of static weaving In this way, a specific grammar 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 proxies.

(6). AOP usage scenarios:

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

In addition, the implementation of Filter and the implementation of the interceptor of struts2 are both the embodiment of the AOP idea.

Ant interview scene and interview answers (document summary)

Ermian Meituan, I've got an offer for surprises and no dangers, I have to say "too difficult"

 

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:

Ermian Meituan, I've got an offer for surprises and no dangers, I have to say "too difficult"

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 also saves friends the time to search for information and organize themselves! Friends who need to get it: follow and forward and add VX [MXM9809] to get it for free

Ermian Meituan, I've got an offer for surprises and no dangers, I have to say "too difficult"

Java interview core knowledge points

Some readers and friends have already got good offers with this guide on Java interview knowledge points. Dear readers and friends, come to me and get it for free.

1000 Java interviews

Ermian Meituan, I've got an offer for surprises and no dangers, I have to say "too difficult"

 

How to get the information: add VX [MXM9809] to get it for free!

Guess you like

Origin blog.csdn.net/Sqdmn/article/details/115186676