OutOfDirectMemoryError
TODO 产生堆外内存溢出:OutOfDirectMemoryError产生原因: 1.springboot2.0以后,使用默认的lettuce作为操作reids的客户端,它使用netty进行网络通信2.lettuce的bug导致netty堆外内存溢出 -Xmx300m; netty如果没有指定堆外内存,默认使用-Xmx300m可以通过-Dio.netty.maxDirectMemory进行设置解
·
redis产生堆外内存溢出:OutOfDirectMemoryError
产生原因:
- 1.springboot2.0以后,使用默认的lettuce作为操作reids的客户端,它使用netty进行网络通信
- 2.lettuce的bug导致netty堆外内存溢出 -Xmx300m; netty如果没有指定堆外内存,默认使用-Xmx300m
可以通过-Dio.netty.maxDirectMemory进行设置
解决方案:
不能使用 -Dio.netty.maxDirectMemory 只去调大堆外内存(时间长了,终究会撑爆)
- 升级letture客户端 2) 切换使用jedis
redisTemplate:
lettuce,jedis操作redis的底层客户端,Spring再次封装redisTemplate;
解决方法
<!-- 引入redis作为缓存-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
更多推荐
所有评论(0)