【问题标题】:Redis connection/buffer-size limit exceeded超出 Redis 连接/缓冲区大小限制
【发布时间】:2012-12-31 16:17:10
【问题描述】:

在对我们的应用服务器进行压力测试时,我们从 Redis 获得了以下异常:

ServiceStack.Redis.RedisException: could not connect to redis Instance at redis-host:6379 ---> System.Net.Sockets.SocketException: An operation on a socket could not be executed because the system lacking enough缓冲区空间或因为队列已满 redis-host:6379 在 System.Net.Sockets.Socket.Connect(IPAddress[] 地址,Int32 端口) 在 System.Net.Sockets.Socket.Connect(字符串主机,Int32 端口) 在 ServiceStack.Redis.RedisNativeClient.Connect() --- 内部异常堆栈跟踪结束 --- 在 ServiceStack.Redis.RedisNativeClient.Connect() 在 ServiceStack.Redis.RedisNativeClient.AssertConnectedSocket() 在 ServiceStack.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs) 在 ServiceStack.Redis.RedisNativeClient.SendExpectData(Byte[][] cmdWithBinaryArgs) 在 ServiceStack.Redis.RedisClient.GetValueFromHash(字符串 hashId,字符串键) 在 ServiceStack.Redis.Generic.RedisTypedClient1.GetValueFromHash[TKey](IRedisHash2 hash, TKey key)

redis 主机端口似乎有超出连接限制。知道如何通过 Redis.conf 或服务器配置来增加此阈值吗?我们已经在 Ubuntu 服务器上托管了 Redis 实例。

【问题讨论】:

  • 你能解决这个问题吗?

标签: redis


【解决方案1】:

我能够复制使用 ServiceStack 超出缓冲区大小限制的相同问题。执行压力测试的代码在这里 - 运行 20 个应用程序实例至少 20 分钟。 https://github.com/ServiceStack/ServiceStack.Redis/commit/b01582f9c873f375794c04d46aad400590ca5bf3

您可能会看到的第一个错误是“无法连接到 redis 实例”,如 Redis unable to connect in busy load,但是如果您展开内部异常,您会看到“无法对套接字执行操作,因为系统缺少足够的缓冲区空间或队列已满”

我的问题出现在 Window7 上,但不是 Window Server 2008 rc。所以我开始看看这是否是操作系统问题。在 ServiceStack 向 Demis 发送电子邮件后,得出的结论是 ServiceStack 正确关闭了套接字。查看操作系统,通过设置 TcpTimeWaitDelay 和 MaxUserPort 解决了问题。

更多参考。 TcpTimeWaitDelay 为 45 秒

和 MaxUserPort http://mashijie.blogspot.com/2009/05/change-default-setting-of-tcp-ports.html

我将端口范围调整为1025-64511

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-25
    • 2013-11-27
    • 2017-05-05
    相关资源
    最近更新 更多