After adding a self-written code to the redis cache, this problem occurred when using JMeter for stress testing:
io out-of-heap memory overflow exception when using netty, this situation generally occurs in large concurrency situations
problem causes
- The reason for this: springboot integrates redis by default using lettuce to operate the redis client after 2.0, and he uses netty for network communication
- I did not specify the off-heap memory in the development, but specified -Xmx100m;
- If netty does not specify off-heap memory, it uses -Xmx100m by default; however, no matter how large you set the memory, as long as there is sufficient concurrency, this exception will definitely occur! (Occurrence reason: we failed to get the immediate release of the memory)
- Its default value can be set by -Dio.netty.maxDirectMemory (do not set the default to use -Xmx100m;)
Solution
- Upgrading our lettuce client
Lettuce advantages: huge throughput; - Switch to using jedis to operate redis
jedis Disadvantages: it has not been updated for a long time,
just as follows: just change the dependency!