Connect to redis through C# redis client slow !
May i know what is the benchmark for C# redis ? I try connect to redis through Tcp/ip with 456 bytes data. The benchmark as below:
hset - 600 writes/seconds, Loo开发者_如何学Gop 10000 times 600 reads/seconds, Loop 10000 times
It this normal? I suspect is the tcp/ip transfer rate slow because slow transfer rate 156 kbps. I had set the TCP receive window size but the speed still same. I tried also using ubuntu benchmark redis through tcp/ip. The transfer rate can up to 3 mbps. hset - >10k per seconds.
The problem is most likely latency - while redis can handle many thousands of operations per second, a single synchronous connection will spend most of it's time waiting for the network. Your test loop is actually something like:
Client Network Server
send GET
1ms
Process GET (0.01 ms)
1ms
Result received
So the operation takes a total time of 2.01ms, but both client and server were idle for almost all of that. This means that you can make good use of parallelism - split your loop across 100 threads so there is no waiting on the network and you can get 100 results in the same 2ms.
The difference in ubuntu is probably due to the fact that you are running it on the same server as redis - even though you are using IP rather than unix sockets, localhost has much lower latency than any connection between different servers.
精彩评论