【问题标题】:Redis Cache - "Server Closed the connection" errorRedis 缓存 - “服务器关闭连接”错误
【发布时间】:2017-06-29 11:42:24
【问题描述】:

我正在运行一些测试以了解 MaxMemory-Reserved 和 MaxMemory-Policy,当 Redis DB 快满时,我们遇到了几次“Server Closed the connection”错误。以下是详细信息:

1) 使用标准 C1(1 GB) 层创建 Redis 缓存并选择“allkeys-lru”和 max-memory-reserved 为 50 MB

2) 运行 Redis Benchmark 工具以在 Redis DB 中添加 Key,以确保 Redis DB 几乎已满。

3) 当 DB 达到约 960-980 MB 时,再次运行 Benchmark 工具以添加更多键并得到以下错误。在哪些情况下会发生此错误? 注意:当我们在遇到此错误之前运行 info 命令时,Connected_Clients 值为 0。

4) 同时在 Azure 门户控制台上运行 info 命令,得到的输出为“错误”。 5)这个错误持续了大约 2-3 分钟,之后我们就可以添加密钥了。一旦我们再次运行 info 命令,我们就会得到以下统计信息。在这里,我们看到 used_memory 和 used_memory_rss 之间的差异约为 76 MB。你认为上面的错误可能是因为这个吗?

信息

服务器 redis_version:3.2.3

redis_mode:standalone

操作系统:Windows

arch_bits:64

multiplexing_api:winsock_IOCP

hz:10

客户

connected_clients:2

client_longest_output_list:0

client_biggest_input_buf:0

client_total_writes_outstanding:0

client_total_sent_bytes_outstanding:0

blocked_clients:0

内存

已用内存:968991592

used_memory_human:924.10M

used_memory_rss:1049776128

used_memory_rss_human:1001.14M

used_memory_peak:1070912296

used_memory_peak_human:1021.30M

used_memory_lua:37888

最大内存:1100000000

maxmemory_human:1.02G

maxmemory_policy:allkeys-lru

mem_allocator:jemalloc-3.6.0 #

【问题讨论】:

  • 你检查过这个document关于内存压力的问题吗?

标签: caching redis azure-redis-cache redis-cache


【解决方案1】:

您很可能会遇到大量未经身份验证的连接的情况。 Redis-benchmark 首先创建所有客户端连接(在您的情况下为 -c 400 连接),然后对它们进行身份验证。身份验证延迟会导致来自单个 IP 的大量未经身份验证的连接,Azure Redis 缓存会关闭它们以进行 DOS 保护。因此,错误“服务器关闭了连接” 您可以尝试here 中的 redis-benchmark,我已对其进行了修改,以便在建立连接后立即进行身份验证,应该可以解决此问题。

【讨论】:

    猜你喜欢
    • 2011-06-06
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 2015-11-06
    • 2016-03-11
    • 1970-01-01
    • 2021-11-08
    • 1970-01-01
    相关资源
    最近更新 更多