o.lettuce.core.RedisException::io.netty.util.internal.OutOfDirectMemoryError 同时从 Redis 中检索一个大对象 (2MB)

o.lettuce.core.RedisException::io.netty.util.internal.OutOfDirectMemoryError while retrieving a big object(2MB)from Redis

我有一个 Spring 连接到 Redis 缓存 (Azure redis) 并检索对象的启动应用程序。对象大小为 2MB 。我有时会收到以下错误。

io.lettuce.core.RedisException: io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 524288000 byte(s) of direct memory (used: 553648128, max: 1073741824)"}.

不是每次都这样。为什么要分配 524288000 字节来检索 2MB 对象?当它工作时,我在 1 秒内得到响应。

详情:

Spring 引导版本:2.1.5

Spring 数据 redis : 2.1.8

生菜芯:5.1.6

io.Netty : 4.1.36

部署环境细节:

环境:Pivotal Cloud Foundry 环境

内存:2GB,直接内存1GB

Redis:

具有 6GB 内存的 Azure Premium Redis。

代码片段:

为了检索对象,我使用了以下代码:

redisTemplate.opsForValue().get(keyname);

然后使用 ObjectMapper 转换为对象。

和所有默认属性。

由于分配似乎是生菜的一部分,我建议在那里打开错误报告。这听起来不正确。