Interview topic: Weizhong interview review

I participated in the interview with Weizhong today. The longer the time, the more tense the problem. The source code details and the series of code problems are gradually exposed. Take advantage of not forgetting, write it down first, and supplement the answers later, the
interview questions are disorderly and the interview duration: 63 minutes

  1. How to deal with the sudden increase of cpu to 100%?
    My answer: Use the top command to view the process with the largest occupancy ratio, use jstack to view specific content, and jmap to view object information

    Reference answer : This is a non-real CPU spike scenario, which is a simulated positioning process.
    1) Log in to the server and execute the top command to view the CPU usage:
    Insert picture description here
    through the above command, we can see the CPU usage of the Java process with the process ID of 12634 Highest (here is a scenario that simulates a high CPU, a real scenario, such as an infinite loop, threads waiting for each other, thread deadlock, etc.). Use ps -ef |grep 91111-912442.jar to check whether the process ID of the current application is consistent with the process with the highest CPU usage. If it is, there is a problem with the application. Use Ctrl+C to exit the command directly.
    2) After locating the problematic process, you need to locate the specific thread that has the problem. Let's see which threads are in the process 12634, and which thread occupies the highest CPU. Use the command top -Hp 12634
    Insert picture description here
    to see through the command that in the process 12634, the thread 12680 occupies the highest CPU. Next, we locate the specific problem of this thread.

  2. How to do a T-1 day data table backup?
    My answer: Use partitions on time, minutes and seconds. The interviewer said it was wrong, but I said to use temporary tables? The interviewer prompts to use paging, and then asks how to deal with the slower the paging is going forward?
    Reference answer: You can use paging, and use subqueries further down. To be added

  3. What is the difference between the transaction created by programmatic jdbc and the transaction of mybatis? How does spring declare programmatic transactions?

  4. How does mybatis bind xml and mapper? How to write foreach in mybatis with high efficiency? What is the difference between java foreach writing statement and mybatis? How to use jdbc directly?

  5. What open source frameworks are available for timing tasks? How to implement a distributed timing task (based on database pessimistic lock)? Do you know the timing tasks of spring?

Saturn (distributed task scheduling platform, support monitoring, based on Elastic Job development)
Quartz (Spring default scheduling framework,)
Elastic-Job (Dangdang open source framework, based on zookeeper to achieve distributed coordination)
Spring Task (also @Scheduled annotation)

  1. Do you understand the thread pool, what are the parameters? I said Executors. Do you know why Ali can't use this tool class? How to set the name of the thread in the thread pool?

    Reference answer:
    thread pool parameters and some extensions

  2. The life cycle of Spring Bean? Declare an annotation how to get the content (reflection), I answered a lot of spring pre and post, enable package scanning. . .

  3. How to parse 1000M xml or excel files without causing memory overflow? What I answered was stream segmentation, which should actually be file tools such as apache. Then I talked about the principle and was confused.

  4. How does poi solve the problem of reading and exporting large files? What is the difference between 1.x and 2.x

  5. How does mybatis bind mapper and xml together, and call the interface, how can it return the data set?

  6. How are transactions used? What are the propagation characteristics? What is the isolation level? I call repeatable reading non-repeatable. . How does spring manage transactions, and what other attributes of transnational annotations? What is oracle's default isolation level?

  7. What is the logging framework used by the system? . What is slf4j used for? My answer is to facilitate log frame switching. Will the system switch after using the framework? Is there any other effect?
    My answer: logback. The role of Slf4j is to unify the interface and facilitate the switching of log frameworks.

Reference answer:

  1. Provide a log interface, provide a method to obtain a specific log object, the framework can be switched directly. Ali's protocol requires that the log framework cannot be used directly for printing, but slf4j must be used.
    Insert picture description here
  2. Unified log printing format, optimize printing performance
  3. slf4j also provides a bridging mechanism to implement APIs for other logs, through slf4j, into the log implementations bound in our project.
    ! ! ! Follow-up need to add specific log source code learning articles
  1. What components have springcloud used and what are they used for?

  2. When transferring parameters, what is the difference between # and $, which one can prevent injection, and what is the principle of anti-injection? How does java write jdbc to prevent sql injection

    Reference answer: view detailed instructions

  3. What is the principle of ukey? What are the commonly used encryption algorithms, which are symmetric encryption and which are asymmetric encryption?

Guess you like

Origin blog.csdn.net/lxn1023143182/article/details/114273116