1

I am trying to use the Redis + ServiceStack as cache on a legacy Classic ASP (VBScript).

There is no Classic ASP Client for Redis and we don't wanna change the way (syntax) the system is written. Today we use third-party component with some specific methods.

So, the idea is create a .NET COM+ with the same exactly methods and wrap the ServiceStack client on it. That is actually done and working. Our problems start at this point.

When we submit just one request, it returns pretty fast (less than a second). But when submit some (100) requests concurrently using Fiddler or Load UI, we see the IIS queue (up to 30) and response time (more than 30 seconds up to 2 min) increasing like crazy.

Could you guys help me figure out what's going on?

I have a singleton to create a manager:

public class CacheFactory
{
    private static IRedisClientsManager _redisClientsManager;

    private CacheFactory()
    {

    }

    public static IRedisClientsManager GetInstance()
    {
        return _redisClientsManager ??
               (_redisClientsManager = new PooledRedisClientManager());
    }
}

These requests are calling the GET method basically:

   public object Get(string key)
    {
        using (var cache = CacheFactory.GetInstance().GetClient())
        {
            var pair = cache.Get<string>(key);

            if (string.IsNullOrEmpty(pair)) return null;

            if (!pair.StartsWith("<MultiArray")) return pair;

            var value = cache.GetValue(fullKey);
            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(value)))
            {
                //Need to cache ADO Recordset, which is an array. The only way I found was using a third-party serializer
                var sharpSerializer = new SharpSerializer();
                var array = sharpSerializer.Deserialize(ms);
                return array;
            }
        }
    }

EDIT

This is the repo with whole solution: https://github.com/dikoga/redis-com-client/

Diego Koga
  • 49
  • 6

1 Answers1

1

PooledRedisClientManager blocks when its pool size is reached, so if you're holding it for a long time it will block until the next client is available. It doesn't look like you need the redis cache when you're doing the serialization so I'd move it outside the using{} so the client gets released back into the pool sooner. Otherwise you can increase the pool size. Or switch to a different Redis Client Manager that doesn't block.

mythz
  • 141,670
  • 29
  • 246
  • 390