Jingdong JAVA interview experience and detailed explanation of interview questions

The winter of 2018 was extremely cold, undoubtedly a cold winter for programmers. I was also one of the layoffs at the end of the year. I submitted a few resumes, and now I have found a job. Although it is not JD.com, it is so-so, but I also want to record JD.com’s interview process.

The entire interview and written test will take 2-3 hours.

Don't talk nonsense and go straight to dry ingredients.

1. What are the commonly used data structures in java? Which ones are thread-safe? How to ensure thread safety?

Because there is too much content, I will directly post the link: https://blog.csdn.net/u010947402/article/details/51878166

2. Java memory model and concurrency guarantee

 

             

But his question is not simply asking you these things. He wants to get your understanding of memory java memory and give the optimal solution in terms of performance. The blogger gives a concurrency guarantee based on the architecture. For example, distributed solutions, anti-generation with nginx, etc., but when I mentioned nginx, I dug a hole for myself, and I will talk about it later in the interview.

3. The internal working principle of the thread pool

Paste link: https://www.cnblogs.com/qingquanzi/p/8146638.html

4. What does deadlock mean and what are the conditions for its formation? What are the ways to troubleshoot a deadlock?

Paste link: https://blog.csdn.net/abigale1011/article/details/6450845/

5. How to place repeated payment (cross-payment) when the user pays during the transaction, please write down the scheme you understand or the scheme you have used

Because the blogger has integrated Alipay's payment module before, I will give my own solution here;

Because it is an http request when calling the Alipay interface, after the payment is completed, Alipay will asynchronously call back our configured acceptance interface, but in this process, it may happen

Due to network, service, system and other reasons, the user paid but failed to call back the bug that changed our database data.

Here, our backend uses the method of submitting queries to avoid users from paying twice. Because Alipay will also record our order number and an order number generated by them when we pay, we can use our order number to call Alipay's order query interface to query the payment status of this order. If it is found that the order number has already been paid, it will be returned directly.

Second, our front-end has also done the corresponding processing of repeated submissions from both sides to avoid users from making repeated payments.

6. What are the types of database indexes and the differences between them

Post link: https://www.cnblogs.com/yuan-shuai/p/3225417.html   Some people will ask why such a detailed post is posted, because the blogger has suffered here, and the interviewer will ask during the interview to very detailed.

7. When debugging through the development tool DeBug during program development, what does the content displayed on the console contain? What content can help you identify problems and solve them.

This blogger will not answer in detail. Let’s follow your own development habits. This question appears in the advanced interview questions. I think there may be a reason for it, but I just use it to see the value of the value and the value of each step of the pointer. Is it expected value. If you have a more practical usage, be sure to comment and share it below.

8. In the process of RPC communication, it is assumed that system A provides a method whose input parameter is a JavaBean and whose output parameter is also a JavaBean. The other two systems B and C call interfaces. The caller B wants to add a return parameter to the provider A. Assuming that the service provider A adds a return parameter, what should the C system caller do?

The blogger did not write this question on paper, but only wrote that he hoped to answer it face-to-face, because this question was written too much. During the interview, I answered like this:

At that time, the blogger pointed out the problem of realizing the requirements of this question. Why do you have to directly modify the interface input parameters on the interface of system A? Because this modification needs to move the codes of A, B, C, and 3 system callers, which brings a lot of inconvenience to the entire business, why not overload the interface of A service, which not only solves the demand problem, It is only necessary to change the codes of the two systems A and B and it will not affect the C system.

When he later asked me if I could implement it through the underlying foundation, I replied with a reflection mechanism and gave it back.

Note: At that time, the blogger misunderstood the return parameter of system A as an input parameter, and pressed the input input to answer it. Looking at it today, I feel that this question is a bit problematic. Isn't there only one anti-parameter? Unless you want to change the data type and use a set to reverse the parameters, I guess it’s a typo.

9. Understand which design patterns, and use pseudocode to implement a design pattern you are familiar with.

Paste link: https://www.cnblogs.com/geek6/p/3951677.html

Here the blogger was asked how many types of command mode and design mode are divided into during the interview process and said the representative of the class

 

interview:

1. The configuration problem of nginx, whether it can be configured to jump to the second-level domain name.

Answer: Yes, and then I asked about the load balancing strategy of nginx, and what is the architecture of nginx originally configured by you.

2. Redis data types and usage scenarios, and memory allocation size, whether you have been in contact with redis clusters, redis cluster configuration and monitoring mechanism, persistence strategies and their differences and application scenarios, hash conflicts, how to ensure that there are hot data in redis, and elimination strategies , commonly used commands, and Jedis’s commonly used api, here will ask how to ensure the atomic operation of redis under multi-threading, if you have used lua scripts, just answer this, JD.com has a lot of questions about redis It is highly recommended to look at the detailed explanation of redis and then answer with your own experience.

You can refer to this first: https://www.cnblogs.com/linkworld/p/7808818.html

3. Tell me how to use distributed locks. Here the blogger used the answer to use redis to implement distributed locks

For reference: https://www.cnblogs.com/linjiqin/p/8003838.html

4. Have you ever used MQ? The blogger here answers the knowledge related to ActiveMQ. Most of the questions here are from the perspective of business solutions. What do you use MQ for, why use it, and the persistence mechanism of MQ , What should I do if the consumption fails? Do you use transaction control when using mq consumption? how to use.

You can refer to: https://www.cnblogs.com/lknny/p/7488310.html   If you have used it, you can answer this question in combination with your business scenarios.

5. How to write a dubbo protocol by yourself? The use of dubbo, the failure strategy, and the problems encountered in the use process, here also mentioned the problem of the system architecture, mainly how to split the services originally, and the relationship between each service.

You can refer to this for custom protocols: https://blog.csdn.net/xiaoliuliu2050/article/details/81382111   The interviewer's intention is to let you tell the implementation logic and your understanding of the http protocol.

Dubbo related: http://blog.51cto.com/developerycj/2050104

6. How to allocate various memory of jvm in your last project.

Here, the spring family bucket and database-related knowledge are hardly asked in the interview. They pay more attention to these middleware-related knowledge. Maybe no one pays attention to the framework when facing this level of positions, because they are all implemented at the bottom. As long as the foundation is solid enough, a big factory is just around the corner.

Finally, I hope that all students can learn useful things. If you think that the blogger has short-sightedness, students can share it below.

 

Guess you like

Origin blog.csdn.net/luxiangyan1923/article/details/86573997