Comments (7)
for (var a = 0; a < 100; a++) {
new Thread((aa) => {
DateTime dt = DateTime.Now;
var ret = RedisHelper.BLPop(60, "cccc" + aa);
Console.WriteLine($"cccc{aa}: {ret}, {DateTime.Now.Subtract(dt).TotalMilliseconds}ms");
}).Start(a);
}
Console.ReadKey();
测试结果正常:
cccc34: , 60129.7488ms
cccc20: , 60282.6324ms
cccc15: , 60335.1473ms
cccc14: , 60335.0859ms
cccc16: , 60326.1788ms
cccc17: , 60301.9166ms
cccc18: , 60289.7199ms
cccc19: , 60289.7423ms
cccc21: , 60273.8179ms
cccc22: , 60257.1674ms
cccc23: , 60248.0073ms
cccc24: , 60239.0745ms
cccc25: , 60228.9134ms
cccc26: , 60216.8416ms
cccc27: , 60210.9641ms
cccc28: , 60203.6344ms
cccc29: , 60191.8092ms
cccc30: , 60184.3046ms
cccc31: , 60177.5059ms
cccc32: , 60163.2017ms
cccc33: , 60153.0093ms
cccc35: , 60129.7485ms
cccc36: , 60122.2616ms
cccc13: , 60352.7668ms
cccc2: , 60539.9713ms
cccc4: , 60531.7854ms
cccc0: , 60557.5156ms
cccc1: , 60550.9153ms
cccc5: , 60522.4098ms
cccc11: , 60470.0393ms
cccc12: , 60462.799ms
cccc8: , 60498.8855ms
cccc3: , 60540.6942ms
cccc6: , 60515.9879ms
cccc7: , 60507.2409ms
cccc9: , 60489.9842ms
cccc10: , 60479.6885ms
cccc46: , 60128.6588ms
cccc45: , 60236.9483ms
cccc44: , 60244.2482ms
cccc40: , 60279.8009ms
cccc41: , 60259.9397ms
cccc42: , 60266.8821ms
cccc43: , 60253.6088ms
cccc37: , 60316.0835ms
cccc38: , 60297.0225ms
cccc39: , 60289.2183ms
cccc47: , 60924.7266ms
cccc93: , 60526.5874ms
cccc90: , 60552.09ms
cccc65: , 60765.7138ms
cccc66: , 60757.7936ms
cccc67: , 60749.3567ms
cccc68: , 60742.7882ms
cccc69: , 60735.983ms
cccc70: , 60727.3415ms
cccc82: , 60619.2249ms
cccc83: , 60604.451ms
cccc84: , 60611.9539ms
cccc85: , 60596.2703ms
cccc86: , 60588.0602ms
cccc87: , 60577.9449ms
cccc88: , 60569.3207ms
cccc89: , 60559.8818ms
cccc91: , 60543.1257ms
cccc92: , 60535.9524ms
cccc64: , 60874.5851ms
cccc63: , 60882.7591ms
cccc61: , 60892.3725ms
cccc62: , 60892.2739ms
cccc50: , 61003.6861ms
cccc51: , 60996.2703ms
cccc52: , 60988.0551ms
cccc53: , 60981.5574ms
cccc54: , 60972.8298ms
cccc55: , 60940.6636ms
cccc56: , 60949.6829ms
cccc57: , 60932.8343ms
cccc58: , 60924.1674ms
cccc59: , 60914.407ms
cccc60: , 60905.3913ms
cccc94: , 60611.2432ms
cccc95: , 60603.2615ms
cccc96: , 60595.8702ms
cccc97: , 60585.8436ms
cccc98: , 60576.7594ms
cccc99: , 60568.9816ms
cccc81: , 60827.6116ms
cccc74: , 60897.9349ms
cccc75: , 60890.7292ms
cccc76: , 60871.6177ms
cccc48: , 61118.435ms
cccc49: , 61109.577ms
cccc71: , 60920.7148ms
cccc72: , 60914.4741ms
cccc73: , 60906.5017ms
cccc77: , 60862.5874ms
cccc78: , 60854.6326ms
cccc79: , 60842.3964ms
cccc80: , 60834.7236ms
from csredis.
测试了多次,BRPopAsync 异步方法,线程数太少处理不过来
需要设置 ThreadPool.SetMinThreads(1000, 1000);,设置后测试 BRPopAsync 平均阻塞62秒。
不然延时会比较严重,同步方法没有影响。
from csredis.
Task 依赖 ThreadPool 线程池执行,原作者不支持异步阻塞 BRPopAsync 方法,估计也是考虑这个缺陷。
from csredis.
使用 BRPop 也是同样结果。
from csredis.
BRPopAsync 貌似会延长时间,你是不是用异步方法。
from csredis.
测试了多次,BRPopAsync 异步方法,线程数太少处理不过来
需要设置 ThreadPool.SetMinThreads(1000, 1000);,设置后测试 BRPopAsync 平均阻塞62秒。
不然延时会比较严重,同步方法没有影响。
收到,谢了~ 经测试,您这个 Thread 没问题,我用的是 Task.Run() ... 应该是 Task.Run() 的问题!万分感谢!
from csredis.
使用 Task.Run 的话设置 线程池最大和最小线程后问题解决。
System.Threading.ThreadPool.SetMaxThreads
System.Threading.ThreadPool.SetMinThreads
from csredis.
Related Issues (20)
- 3.8.671 vs 3.8.668 HOT 1
- TONG RDS(国产信创) 哨兵有问题 HOT 9
- 请问在哪里查看版本更新日志 HOT 2
- Thread CurrentCulture csredis hash exception with docker container HOT 15
- Linux 下面 Connection timed out.问题有办法解决吗? HOT 1
- 读取redis抛InvalidCastException HOT 1
- cacheshell哈希表不支持设置-1永久有效 HOT 3
- 请问可以监听redis键过期事件吗 HOT 1
- 请问一下有没有方法取消管道操作 HOT 4
- 这块每次 new byte对GC不太友好,还有读取的时候,建议使用 ArrayPool了
- 链接池中数量
- SlowLogGetAsync HOT 4
- csrediscore is missing NuGet package README file
- 关于前缀的问题 HOT 1
- 哨兵 Master 重新选举后出现 Connection was not opened HOT 3
- ReadLine()判断不严谨,导致内存暴增问题 HOT 4
- feat 增加获取锁间隔
- Status unavailable, waiting for recovery. Connect to server timeout HOT 4
- 内网环境下Status unavailable, waiting for recovery. Connect to server timeout HOT 2
- 内网环境下Status unavailable, waiting for recovery. Connect to server timeout HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csredis.