1

I am trying to integrate StackExchange.Redis client into my solution to do request logging.

High availability is essential, so the logging component must survive network failures and potential redis cluster outages. Precision is not essential, so I am using "Fire & Forget" mode.

To test network outage scenario I have created a test web application with the following code:

namespace WebApplication1
{
    public static class Logger
    {
        private static readonly IDatabase _db;

        static Logger()
        {
            var configurationOptions = new ConfigurationOptions();
            configurationOptions.AbortOnConnectFail = false;
            configurationOptions.ConnectRetry = 1;
            configurationOptions.ConnectTimeout = 100;
            configurationOptions.EndPoints.Add("test.example.com", 6379);

            var redis = ConnectionMultiplexer.Connect(configurationOptions);
            _db = redis.GetDatabase();
        }

        public static void Push()
        {
            _db.ListRightPush("key", "value", When.Always, CommandFlags.FireAndForget);
        }
    }

    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Logger.Push();
        }
    }
}

...and hit it with 50k requests using Apache Bench. After reaching 1.1GB working set, local IIS crashed.

This is not at all what I expect, given it is configured it to only retry once and timeout after 100ms.

Have I misconfigured it?

4

0 回答 0