In a test process, found that the back-end user service suddenly hung up, the number of users is not large, a few people can not use. The middle tier found a large number of timeout errors, and later checked the GC logs of the user service, and found a very strange phenomenon: the number of Full GCS was even higher than that of Young GCS. Here is the GC statistics after stopping the request:

Two Full GC exceptions within one second caught at some point in the middle:

And went to look at itThe GC log, found many timesGCFailed message:Then run normally, in order to make service configuration to turn over times, then stop all test, only an account used for debugging, can find shored up, finally found the problem: the middle tier service call back-end query interface, limit the number of parameters not handed in, lead to check every time all the total amount of information, about more than 40000.

For each request from the middle tier, the user can handle it at first, but soon it won’t work because the List is so large and the query consumes too much resources.

However, why is Full GC better than Young GC? I remember the book I read two days ago, which is about Java allocating large objects, as follows:

The original large object may be directly in the old generation, and then lead to Full GC frequent, due to memory shortage, leading to Full GC failure.

Related articles

  1. zhuanlan.zhihu.com/p/108184575