2017-11-08 5 views
0

[C#] CacheManagerでRedis Serverのプールサイズを設定するにはどうすればよいですか?CacheManagerでRedis Serverのプールサイズを設定する方法は?

高い同時実行性でエラーが発生しました:この操作を処理するための接続はありません:HMGET、接続プールサイズの設定方法?

No connection is available to service this operation: HMGET U 

at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) 
    at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) 
    at StackExchange.Redis.RedisDatabase.HashGet(RedisKey key, RedisValue[] hashFields, CommandFlags flags) 
    at CacheManager.Redis.RedisCacheHandle`1.<>c__DisplayClass25_0.<GetCacheItemInternal>b__0() 
    at CacheManager.Redis.RetryHelper.Retry[T](Func`1 retryme, Int32 timeOut, Int32 retries) 
    at CacheManager.Redis.RedisCacheHandle`1.Retry[T](Func`1 retryme) 
    at CacheManager.Redis.RedisCacheHandle`1.GetCacheItemInternal(String key, String region) 
    at CacheManager.Redis.RedisCacheHandle`1.GetCacheItemInternal(String key) 
    at CacheManager.Core.Internal.BaseCache`1.GetCacheItem(String key) 
    at CacheManager.Core.BaseCacheManager`1.GetCacheItemInternal(String key, String region) 
    at CacheManager.Core.BaseCacheManager`1.GetCacheItemInternal(String key) 
    at CacheManager.Core.Internal.BaseCache`1.GetCacheItem(String key) 
    at CacheManager.Core.Internal.BaseCache`1.Get(String key) 
    at CacheManager.Core.Internal.BaseCache`1.Get[TOut](String key) 

=======================

 var cache = CacheFactory.Build("RuntimeCache", settings => 
     { 
      settings.WithSystemRuntimeCacheHandle("RuntimeCache") 
      .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(10)) 
      .And 
      .WithRedisConfiguration("RedisCache", config => 
      { 
       config.WithAllowAdmin() 
       .WithDatabase(1) 
       .WithPassword(password) 
       .WithEndpoint(host, port); 
      }) 
      .WithMaxRetries(100) 
      .WithRetryTimeout(50) 
      .WithRedisBackPlate("RedisCache") 
      .WithRedisCacheHandle("RedisCache", true) 
      .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(30)); 
     }); 

答えて

1

Stackexchange.Redisが、代わりに、接続プールを使用しません。 multiplexingを使用します。

configuration => syncTimeoutを使用して、ライブラリが同期呼び出しを待機する時間(デフォルトは1000ms)を変更できます。 (CacheManagerでそれを使用するには、接続文字列ベースの設定を使用するか、Multiplexerを自分で作成してください)。 これは、あなたの経験を向上させる可能性があります。

とにかくタイムアウトとそのような接続エラーは、ほとんどの場合クライアントと無関係であり、特にサーバーのメモリ制限に達した場合やRedisがキーを削除しようとした場合、Redisサーバーのシングルスレッドの性質によって引き起こされます。 Redisのは...ディスクへのバックアップに

をしようとする場合、私はそれらの問題は、あなたがやろうとしているかに大きく依存しているとして、あなたにもっと明確な答えを与えると、使用しているRedisのサーバーができない...

ますそのエラーに関する多くの他のq/aが見つかります。 StackExchange.Redis timeout and "No connection is available to service this operation"

関連する問題