超出 Redis 连接/缓冲区大小限制 [英] Redis connection/buffer-size limit exceeded

查看:49
本文介绍了超出 Redis 连接/缓冲区大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

While stress testing our application server we have got the following exception from Redis:

ServiceStack.Redis.RedisException:无法连接到 redis-host:6379 处的 redis 实例 ---> System.Net.Sockets.SocketException:无法对套接字执行操作,因为系统缺乏足够的资源缓冲空间或因为队列已满 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(String hashId, String key)在 ServiceStack.Redis.Generic.RedisTypedClient1.GetValueFromHash[TKey](IRedisHash2 hash, TKey key)

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 performed because the system lacked sufficient buffer space or because a queue was full redis-host:6379 at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port) at System.Net.Sockets.Socket.Connect(String host, Int32 port) at ServiceStack.Redis.RedisNativeClient.Connect() --- End of inner exception stack trace --- at ServiceStack.Redis.RedisNativeClient.Connect() at ServiceStack.Redis.RedisNativeClient.AssertConnectedSocket() at ServiceStack.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs) at ServiceStack.Redis.RedisNativeClient.SendExpectData(Byte[][] cmdWithBinaryArgs) at ServiceStack.Redis.RedisClient.GetValueFromHash(String hashId, String key) at ServiceStack.Redis.Generic.RedisTypedClient1.GetValueFromHash[TKey](IRedisHash2 hash, TKey key)

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

It seems that there are connection limit exceeds on redis host port. Any idea how to increase this threshold through Redis.conf OR server configuration? We have hosted the Redis instance over Ubuntu server.

推荐答案

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

I was able to duplicate the same issue of buffer size limit exceeded using ServiceStack. The code to do the stress testing is here - run 20 instances of the application for at least 20 minutes. https://github.com/ServiceStack/ServiceStack.Redis/commit/b01582f9c873f375794c04d46aad400590ca5bf3

您可能会看到的第一个错误是无法连接到 redis 实例",如下所述Redis 忙负载无法连接,但是如果你扩展内部您看到的异常无法执行对套接字的操作,因为系统缺少足够的缓冲区空间或因为队列已满"

The first error you may see is "Could not connect to redis instance" as described by Redis unable to connect in busy load, but if you expand the inner exception you see "An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"

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

My problem occured on Window7, but not Window Server 2008 rc. So I begin to look at if it was an OS problem. After emailing Demis at ServiceStack, it was concluded that ServiceStack was closing the sockets correctly. Looking at the OS, the problem was fixed with setting TcpTimeWaitDelay and MaxUserPort.

更多参考.TcpTimeWaitDelay 到 45 秒

More references. TcpTimeWaitDelay to 45 seconds

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

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

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

I adjusted the port range to 1025-64511

这篇关于超出 Redis 连接/缓冲区大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆