Renchunbing / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
1 stars 0 forks source link

KetamaMemcachedSessionLocator 中的 SecureRandom 导致大量线程 blocking 在 nextBytes(byte[] bytes) 方法上 #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. 使用 KetamaMemcachedSessionLocator 一致性hash算法
2. 短时间内发起大量对memcached的访问(压力测试)
3. 因为实际上 locator 
只有一个实例,从而所有线程都会堵塞在该实例的 random 
成员变量的 nextBytes(byte[] bytes) 方法上。

可能的解决方案:
使用 Random 而不是 SecureRandom ,会对结果有影响吗?

-Wesley Wu
wumengye@gmail.com

Original issue reported on code.google.com by wumengye@gmail.com on 30 Dec 2010 at 11:46

GoogleCodeExporter commented 9 years ago
没有影响,这里确实没必要使用SecureRandom,我会修正。这个��
�机数产生器主要用于在使用连接池的时候,往同一个memcached�
��所有连接上选择一个连接来发送,因此用伪随机数完全可以
。

Original comment by killme2...@gmail.com on 31 Dec 2010 at 1:20

GoogleCodeExporter commented 9 years ago
呵呵,多谢,除了这个之外,其他的部分用得挺好,一台机��
�随便撑几百万的PV:)
另外,有空会测试下你做的 HandleSocket 的client,感谢贡献!

Original comment by wumengye@gmail.com on 31 Dec 2010 at 3:38

GoogleCodeExporter commented 9 years ago
1.3.0已经发布,欢迎测试。

Original comment by killme2...@gmail.com on 4 Jan 2011 at 6:19