2881099 / csredis

.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
MIT License
2.02k stars 414 forks source link

异步调用时READ采用同步模式 #340

Open sunliusi opened 4 years ago

sunliusi commented 4 years ago

异步调用READ采用block同步调用

at CSRedis.Internal.IO.RedisIO.ReadByte() at CSRedis.Internal.IO.RedisReader.ReadType() at CSRedis.Internal.IO.RedisReader.ExpectType(RedisMessage expectedType) at CSRedis.Internal.IO.RedisReader.ReadBulkBytes(Boolean checkType) at CSRedis.Internal.IO.RedisReader.ReadBulkString(Boolean checkType) at CSRedis.Internal.Commands.RedisString.Parse(RedisReader reader) at CSRedis.Internal.RedisConnector.CallAsync[T](RedisCommand1 command) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at CSRedis.Internal.RedisConnector.CallAsync[T](RedisCommand1 command) at CSRedis.RedisClient.WriteAsync[T](RedisCommand1 command) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at CSRedis.RedisClient.WriteAsync[T](RedisCommand1 command) at CSRedis.RedisClient.GetAsync(String key)

2881099 commented 4 years ago

因为 resp 协议的原因,经常会 Read 几个字节,继续向后读取。

一个简单的命令需要N次 async 切换 Task 线程调度,不利于性能。

sunliusi commented 4 years ago

我稍后进行下性能测试