ServiceStack.Redis: Unable to Connect: sPort:

匿名 (未验证) 提交于 2019-12-03 00:57:01

问题:

I regularly get ServiceStack.Redis: Unable to Connect: sPort: 0 or ServiceStack.Redis: Unable to Connect: sPort: 50071 (or another port number).

This appears to happen when our site is busier. Redis itself appears fine, no real increase in CPU or memory usage.

I'm using connection pooling and have tried changing the timeout values without success.

public sealed class RedisConnection {     // parameter values are:     // Config.Settings.RedisPoolSize = 10000     // Config.Settings.RedisPoolTimeoutSeconds = 2     // Config.Settings.RemoteCacheServerName = 192.168.10.12     private static readonly PooledRedisClientManager instance         = new PooledRedisClientManager(Config.Settings.RedisPoolSize,                                        Config.Settings.RedisPoolTimeoutSeconds,                                        new string[] { Config.Settings.RemoteCacheServerName })         {             ConnectTimeout = 1500         };      static RedisConnection()     {     }      public static PooledRedisClientManager Instance     {         get         {             return instance;         }     } } 

Usage is like this:

public sealed class Caching {     public static T GetCacheSingle<T>(string key)     {     using (var redisClient = RedisConnection.Instance.GetReadOnlyClient())     {             var value = redisClient.Get<byte[]>(key);             ....     }     } } 

回答1:

This was caused by latency issue due to Redis running on Ubuntu hosted as a virtual machine on Hyper-V.

We reduced latency by 45% by moving to a physical Linux box, fixing the problem.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!