Quiet son recently summed up some interview questions, that is because to do anything to be serious. Interview is also the same, as the new U.S. Financial Department of the interviewer, responsible to tell everyone, the following questions can not answer, the interview is too much. But the following is not the original problem, you will find that their strength is not strong, and eventually must be asked.
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
Below the quiet son to own interview standard simple answer how these questions answer calculate pass.
1> How to locate an on-line service oom problem
Because the interview is mainly to look at the idea, the answer is second, then if I answer this question. I may have to say the whole idea: the Java service Oom, the more common reason is
?? It's possible that memory allocations are really too small, and the normal business uses a lot of memory
For example, the JMAP-HEAP command can look at the heap memory size and usage of the old generation, and see if the memory itself is too small.
?? An object is frequently requested, but is not released, memory is constantly leaking, resulting in memory exhaustion
For example, the Jmap-histo:live object displays information about the surviving object and sorts it by the amount of memory it occupies. 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
You can use Pstree, netstat to view the number of threads created by the process, the number of network connections, and oom if resources are exhausted. You can also view/proc/${pid}/fd and/proc/${pid}/task, and view handle details and the number of threads.
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.
The GC roots objects include the following (the question was asked by our architect when the new beauty was coming):
?? 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 primary area of GC management is the Java heap, which is typically garbage collected only for heaps. The method area, stack, and local method areas are not managed by the GC, so they are selected as GC ROOTS. Objects referenced by GC roots are not garbage collected.
3>mysql InnoDB How to do query optimization
The answer to this question is much more, each person's experience is not the same. The main research in the work practice in the summary and thinking ability. It is best for the interviewer to add an example to the actual project after summarizing the general answers.
?? 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.
Many people say that the face test and the actual development of the contact is not very good. In fact, a lot of live training two months are capable. The gap between people is really not obvious to the extent that you can do what I can't. But I have done a project before, I work with others, I have to revise a lot of other people's various slow query problems, performance problems, and so on. I looked at the SQL they wrote and I found out that these SQL I would take for granted. Because I pay attention to these aspects in everyone, I take it for granted, knowing that this affects performance.
There is also a good interview evaluation of the people actually write code when the problem is less, because they consider more comprehensive. Many people do not intentionally want to make a bug, but do not know Ah, do not know to consider the situation A, case B, do not know the implementation of the JVM bottom, so there may be unexpected results. There's a problem and I don't know which way to think.
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 Synchronouse synchronous lock by using CAs.
CAS is implemented by invoking JNI code
Off-topic time:
These years, Halloween will buy pumpkins to make their own pumpkin lanterns. I give small meat in the United States to buy the Western knife is very safe, I have to wash the pumpkin, next to put a clean iron basin, let small meat carving their own pumpkin lamp, I go to sleep. Because I promised to make pumpkin cake for the leftover of the pumpkin lamp, so I would sleep and see the table very clean. I remember a year I feel wasted, the pumpkin on top of the cover also do eat, small fresh meat is very angry, we had to go together the next day to buy a little babe pumpkin re-made a pumpkin lamp.
Pumpkin pie can be cooked directly into the pumpkin and put the sugar flour made into cakes fried. It tastes better with milk and noodles. I always used to pinch out all kinds of animal shapes to make a dish of wild animals in the outside Coke. But if it is a whole pumpkin, then steamed into 9 minutes after cooked with the flour with a pestle pounded, the longer the more elastic. The work is, of course, given to small meat. But this is not good shape, only with a spoon to make the ball into the pot. Oil pot start is small fire, pumpkin cake cooked almost, and then open big ignition, outside crisp, inside soft.
But now are very busy, the weekend is just office space to make small fresh meat snacks. Remember the original always special leisure, find a job also always do not give themselves pressure, said he did not do management. Live a life where you can control yourself. Once with small meat to Hua Ke see peony, see a girl leisurely lying on the couch sun. This is not the original self. Leisurely after so many years, tell oneself "has the flower to fold straight must fold", has already prepared to accept now all, but really arrives at the time, except fortunately oneself wants to do all tried, still is somewhat sad.
The man on my mobile phone to see my boss directly hired. I said: "The other husband check-daughter-in-law mobile phone is to see the wife in the end who chatted with the day, all talk about what, you look at you." The male God casually said: "Yes, care ah, so put your mobile phone confiscated." "And then look at the boss directly hired.
Don't look at the weekend is like this, usually I am busy do not go home, that is, the weekend to go home a trip. Every day God gave me greet and asked me if I was alive. He recently changed his avatar, the head is a road east of the soft, because the two of us in the east of the time each morning when we both can be on the road to a face. Since then, two people are concerned about each other, trust each other, and work together to move forward. Struggle is very hard, if a person's words are difficult to persist. Two people encourage each other to go forward, want to give up, always do not have the heart to let each other down, so they achieved one after another goal.
The male God has recently been on the way to open the interview, the interview process has harvested a dozen young beautiful headhunting and HR. Because he changed his job for the reason: "I want to find a close to my wife's work, every day to transfer daughter-in-law commute." "I believe in the self-control of my family, see the male God's offer pay seconds to kill me, I hurriedly send a message to ask him:" After you so cool, but also to wash my clothes every week? The man did not hesitate to return a: "Can". The result of weekend home told me that my last week's clothes and a few did not wash, let me have time to wash their own, I suddenly feel that the sky is so cold. Also fantasy to persuade my family God to our new beauty, as I used to be in everyone's time, every weekend to clean my station. Not to come, standing next to a goddess Harvester, I have some pressure.
When a person stands in front of himself, in fact, his heart is very clear. Who is suitable, who is fond of. And the person who is right depends on the plan of his life. Planning to choose the right one to be happy, the person born for the talent will choose to like. If the next life is still the repetition of this life, even though the sentimental is more bitter than ruthless. Pain is the source of talent, experience will be empathy. Originally saw a 0-dimensional space to 10-dimensional space, suddenly feel that the people who have met before is one of the dimensions of the choice, but they do not like the choice, so in this space to do the adjustment.
A person had a dream, woke up to sigh with a dream. In fact, in the dream, there are tens of thousands of cells in the body for the whole life to deduce this dream. Who can be sure that they are not a cell in the dreams of others? So, do not take yourself too seriously, deductive good yourself, good dream!
Into my new beauty of the Java background development face of the question summary