Summary of Java Background Development questions

Source: Internet
Author: User
Tags cas reverse dns

1> How to locate an on-line service oom problem

2>JVM GC roots exist in those places.

3>mysql InnoDB How to do query optimization

4>java the concept of CAs

Java Services Oom, the more common reason is

?? It is possible that the memory allocations are indeed too small, and the normal business uses a lot of memory such as the JMP-HEAP command to see the new belt, the old age memory size situation. See if the memory itself is allocated too small.

?? An object is frequently requested, but not released, and memory leaks, resulting in memory exhaustion, such as the Jmap-histo:live object displays information about the surviving object and sorts it according to the size of the memory being occupied. It is intuitive because it contains the number of instances, the size of the memory, and the class name.

?? A resource is frequently requested and system resources are exhausted, for example: creating threads continuously, initiating network connections

2>JVM GC roots exist in those places,

Ask this question is the first step forward, if not, before directly answering this question, it is best to briefly describe the JVM's memory structure and root search algorithm (GC ROOTS tracing) for accessibility analysis.

?? Referenced objects in the virtual machine stack (local variable table in the stack frame)

?? Object referenced by class static property in the method area

?? The object referenced by a constant in the method area

?? Referenced objects of JNI in the local method stack

The main area of GC management is the Java heap, which is typically garbage collected only for heaps. The method area, stack, and local method zones are not managed by the GC, so they are selected as GC ROOTS and are referenced by GC ROOTS not

be garbage collected.

MySQL InnoDB how to do query optimization

?? Innodb_buffer_pool_size the function of this parameter is to buffer the data and index, the performance can be linearly improved, the maximum can be set to the size of memory 70% or 80% of the appearance

?? Open the slow query log, add parameters: Log-queries-not-using-indexes, easy to put the system in the index of the SQL statement to fully grasp the optimization

?? Query analysis through explain to see if there is no index, the number of rows accessed rows

?? Turn off skip_name_resolve to reduce the consumption of reverse DNS resolution

In addition, there are some actual writing code in the process of deep bone marrow, such as data static and dynamic separation to improve the hit rate of query_cache, reduce field redundancy, reduce the number of queries, complex query decomposition, paging optimization what.

4>java the concept of CAs

Cas:compare and swap, compare and swap

In the Java concurrent package, a kind of optimistic lock is distinguished from the synchronized synchronous lock by using CAs.

CAS uses the CAS instructions of the CPU, while borrowing Jndi to complete the Java non-blocking algorithm, and other atomic operations are done using similar features. Java's concurrent package is primarily dependent on it for the use of synchronized performance improvements.

Summary of Java Background Development questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.