19 years of study combined with work notes

1, about the object in conjunction with JVM

  When the write function codes, try to create a method where a small object, because when a high volume of concurrent frequent create and destroy large numbers of objects, JVM will produce enormous pressure, may crash.

2, on the JVM parameters

  In the actual development, test an object tools can account for how much memory, concurrency if 1000, when the number of objects will be a total memory footprint down calculations. Combined with the new generation, garbage old's clear thinking, setting the new generation of three districts, memory size and old age.

3, about the object

  In the real business code, the general increase in the target @Service @Controllere, are created once, has been used, it will be after it is created, through MinorGC into the old era.
  We are a local variable interfaces, methods inside, are used once and basically no longer in use (unless escape method), so objects in the new generation, will soon recover, it will not enter the old era.
  We actually write business code, to try to take into account when creating the object, do not create a large number of objects in a way where, to avoid frequent starting MinorGC. (In conjunction with the first review)

4, on a constant classes and data dictionary

  ; To define static variables - if only a simple key, you can use the constants class
  if it is immutable key + value format, you can use enumeration to define;
  if it is immutable key and value variable, that variable's value it is taken from the persistence of areas, such as mysql. key, then you can use the constants class - Static variables to define.

5, on how to analyze JVM optimization

  Analysis of a project, how many objects will produce 1 second, the sound of the new generation of the Eden area and how much Survivor region. YGC will happen after a number of seconds. When YGC happen, if there is space rules on security, the remaining size of the new generation of old age is greater than the average memory size every surviving objects recovered. If old's next release, YGC occurs, if old's fit, FullGC occurs.

  If the new generation of the Eden area garbage, live objects larger than the size of Survivor areas, the survival of these objects will be saved directly to the old era, it is full of objects quickly make the old era.
  So optimization is to first analyze the situation. Then targeted, adjust the size and the size of piles Survivor region, the live objects from Eden area, will be copied to the Survivor areas.
  And if a large memory machines, for extranet users access should be set to G1 garbage collector garbage collector.

Guess you like

Origin www.cnblogs.com/AlmostWasteTime/p/11325045.html