When it comes to performance, our focus is no longer on the functions of the software or system, but on the resource efficiency shown in the process of realizing the functions. Software high-performance design includes the following
1. Pooling thinking
What is pooling?
Simply put, it is to set up a public object pool, and directly reuse the objects in it instead of using new creation.
1. JDK's packaging type value cache pool
Integer::IntegerCache integer wrapper cache
Used for binning operations on numbers between [-128, 127]. The maximum value can be set by "java.lang.Integer.IntegerCache.high".
It is initialized when it is used for the first time, and its size can be set by -XX:AutoBoxCacheMax=.
Character::CharacterCache
The cache size is size = 127, that is, char characters in the value range [0, 127] are stored.
Long::LongCache
Cache size size = -(-128) + 127, that is, store long values in the range [-128, 127].
Byte::ByteCache
Cache size size = -(-128) + 127, that is, store the byte value in the range [-128, 127].
Short::ShortCache
Cache size size = -(-128) + 127, that is, store the short value in the range [-128, 127].
2. Netty memory pool
Nett