Ali interview questions (1)

(The following interview questions are collected from the interview experience questions of various recruitment websites)                                              

1. How to prevent repeated order creation caused by network jitter?

Answer: Reason: In your case, the client request has been sent, the server has written to the database, and the network is disconnected when it returns to the completion status. At this time, the client does not receive feedback that the order has not been generated, and then clicks to place an order. At this time, the network is good, and as a result, two are generated.

Solution: (1). If the order to be paid is being paid, lock the order here and change it to an intermediate state, so that the order will not be paid repeatedly (the front end will change the submit button when the submit button is clicked for the first time). into the disabled state, until the submit button restores the state after the background returns to the state)

                 (2). The background code can be modified to use the thread pool to avoid repeated submission. Using synchronized will generate duplicate data. If it is added, duplicate data will not be generated and the expected effect will be achieved. When the front desk repeatedly submits for the second time, and then returns a status by querying the background, the front desk prompts "cannot submit repeatedly"

                  (3). By querying the key field information of this order in the database to see if there is a duplicate order, if there is, the front desk will return to the front desk "non-repeatable submission" when it is repeatedly submitted.

 

2. How to survive the connection storm after the server is started?

3. JVM GC principle?

Reference: http://blog.csdn.net/lzxadsl/article/details/50159939

4. Class loading mechanism?

Reference: http://blog.csdn.net/fgets/article/details/52934178

5. JVM optimization?

Reference: http://blog.csdn.net/kefengwang/article/details/54378235

6. Tell me about your understanding of KAFAKA?

Modern Internet distributed systems, as long as they are slightly larger, cannot escape from three types of middleware: remote call (RPC) framework, message queue, and database access middleware. Kafka is a representative product of message queue middleware, implemented in Scala language.

Reference: https://www.cnblogs.com/yangxiaoyi/p/7359236.html

7. Talk about the realization of multi-threading, synchronization, asynchronous, optimization?

     A: Synchronization is one thing, one thing to one thing to do.
            Asynchronous is, do one thing, do other things without triggering.

 

There are two implementation methods for multi-threading, namely inheriting the Thread class and implementing the Runnable interface;

There are two implementations of synchronization, namely synchronized, wait and notify

Multithreading optimization reference: http://blog.csdn.net/luofenghan/article/details/78596950

8. Tell me about the thread pool? What is the status of the threads in the thread pool?

Thread pool function: In short, creating and closing threads frequently is very CPU-intensive, and thread pools can reduce overhead

Understanding thread pool reference: https://www.cnblogs.com/aspirant/p/6920418.html

Thread pool status: http://blog.csdn.net/l_kanglin/article/details/57411851

9. What are the data structures?

Answer: http://blog.csdn.net/gzl0524/article/details/78929154

10. What is the difference between hashmap and hashtable? The data structure of hashmap? The specific implementation of hash?

Answer: http://blog.csdn.net/fujiakai/article/details/51585767

11. What do you know about design patterns? Talk about singleton pattern, factory pattern, proxy pattern

Answer: By the way, spring's aop is based on the proxy mode, which can realize the logging function, etc.

12. Classification of sets and their respective principles?

Answer: http://blog.csdn.net/qq_35124535/article/details/66971650

13. What is the difference between distributed and clustered?

Answer: Cluster is a physical form, and distribution is a way of working

Reference: http://huangyongxing310.iteye.com/blog/2317865

14. Database locks

answer:

      The locking mechanism has two levels.

       One is at the code level, such as the synchronization lock in java. The typical synchronization keyword is synchronized. I will not explain it too much here.

       If you are interested, you can refer to: http://www.cnblogs.com/xiohao/p/4151408.html

       The other is at the database level, typically pessimistic locking and optimistic locking. They are pessimistic locks (traditional physical locks) and optimistic locks.

15. Introduction to transactions in java

Answer: http://blog.csdn.net/sinat_33536912/article/details/51200630

16. JVM memory management mechanism?

Answer: https://www.cnblogs.com/newyunhe/articles/5001056.html

17. Familiarity with the Concurrent package

18. The mechanism of various locks of the database

Answer: http://blog.csdn.net/lexang1/article/details/52248686

19. Types of indexes and their respective implementations

Answer: https://www.cnblogs.com/barrywxx/p/4351901.html

20. High concurrency understanding and solutions

Answer: http://blog.csdn.net/systemzyf/article/details/70258041

21. Database optimization?

Answer: It is best not to set null value, avoid calculation in SQL statement, avoid In, resulting in full table scan

22. How to deal with the problem of thread synchronization under distributed?

Answer: http://www.fx361.com/page/2017/0309/1098261.shtml

23. How to deal with concurrency and synchronization?

Answer: http://betakoli.iteye.com/blog/2257095

 

pa: The answer comes from the online search results, you can refer to~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325835430&siteId=291194637