nono303 / memcached

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

version 1.5.6 very slow

dushouke opened this issue · comments

I use BenchmarkDotNet test version 1.5.6 get one key performance, it's very slow, average 15ms.
use version 1.6.17 is normal, average less than 1 millisecond.
Is there any special setting in version 1.5.6?

image

public class MemcachedTest
{
    private MemcachedClient _client_mingw_168;
    private MemcachedClient _client_cygwin_156;
    private MemcachedClient _client_cygwin_1617;

    private static readonly string TestKey = "Ping";

    [GlobalSetup]
    public void SetUp()
    {
        _client_mingw_168 = GetClient(11211);
        _client_mingw_168.Store(StoreMode.Set, TestKey, 10);

        _client_cygwin_156 = GetClient(21211);
        _client_cygwin_156.Store(StoreMode.Set, TestKey, 10);


        _client_cygwin_1617 = GetClient(31211);
        _client_cygwin_1617.Store(StoreMode.Set, TestKey, 10);

    }

    [Benchmark]
    public int Get_mingw_168()
    {
       return _client_mingw_168.Get<int>(TestKey);
    }

    [Benchmark]
    public int Get_cygwin_156()
    {
       return _client_cygwin_156.Get<int>(TestKey);
    }

    [Benchmark]
    public int Get_cygwin_1617()
    {
        return _client_cygwin_1617.Get<int>(TestKey);
    }


    private static MemcachedClient GetClient(int port = 11211)
    {
        IPAddress.TryParse("127.0.0.1", out var ipAddress);
        var memcachedClient = new MemcachedClient(new MemcachedClientConfiguration
        {
            Protocol = MemcachedProtocol.Text,
            Servers = {new IPEndPoint(ipAddress, port)}
        });

        return memcachedClient;
    }
}