Skip to content

Performance issue with 2.x #1901

Closed
Closed
@kimglory

Description

@kimglory

We had been using 1.2.6 for quite some time. 2 months ago, we decided to upgrade to 2.x. We did some testing, then ran into the performance issue. We have a service running in a cluster of 20 machines. For testing purpose, we upgraded and deployed 5 machines under 2.x. After running it for a while, we see that CPU of these 5 machines are higher than the other 15. Rough number is 70% vs 60%, which is pretty bad. Yesterday we did it again using the latest version 2.2.79, but the result is the same.
We did some performance testing using performance profiler in VS but didn't find anything useful. After reading the release note, we noticed that one of the biggest changes for 2.x is that it uses Pipelines.Sockets.Unofficial. So this is what we suspect that caused the perofrmance issue. However, we cannot find any proof.
What is so strange is that we replicate this issue in difference services and yet didn't find anyone reporting this issue over the internet. So we need some help here.

Some spec:

  1. IIS 10.x. Tried both on win server 2016 and 2019
  2. 500 QPS per machine
  3. 50+ redis calls per search
  4. All requests are StringGet

Some code:

// Constructor
 public RedisCacheClient(CacheClientConfig config)
        {
            _config = config as RedisClientConfig;
            _redisConnection = new RedisConnection(_config);

        }

...

// Connection init. Only one database will be created for a redis instance. 
private void InitConnection(RedisConnectionString redisConnectionString, out ConnectionMultiplexer connection, out IDatabase database, out IServer server)
        {
            connection = ConnectionMultiplexer.Connect(redisConnectionString.ConnectionString);
            server = connection.GetServer(redisConnectionString.ConnectionString.Split(',')[0], DefaultPort);
            connection.ErrorMessage += Connection_ErrorMessage;
            connection.InternalError += Connection_InternalError;

            database = connection.GetDatabase(redisConnectionString.OperateDb);
        }

...

// Get string values
public async Task<List<TEntity>> GetListAsync<TEntity>(List<string> keys, CacheGetOptions<TEntity> options = null)
        {
            var redisValues = await _redisConnection.ReadDatabase.StringGetAsync(keys.Select(k => (RedisKey)FormatKey<TEntity>(k, _redisConnection.ReadKeyType)).ToArray()).ConfigureAwait(false);

            return redisValues.Select(redisValue => TryAutoConvertToValue<TEntity>(redisValue, _config.RedisValueType).Item2).Where(v => v != null).ToList();
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions