nfhu / xmemcached

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

线程池影响速度问题 #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.builder.setConnectionPoolSize(); //设置线程数

What is the expected output? What do you see instead?
使用1个连接的情况:
2011-06-30 17:54:15,378 WARN  
[com.google.code.yanf4j.core.impl.AbstractController] The Controller started at 
localhost/127.0.0.1:0 ...
2011-06-30 17:54:15,392 WARN  
[com.google.code.yanf4j.core.impl.AbstractController] Add a session: 
127.0.0.1:11211
测试线程数:2 每个线程执行操作数:50000
Thread-12花费时间:8.019
Thread-12每秒执行:6235.1914203766055
Thread-11花费时间:8.039
Thread-11每秒执行:6219.679064560269

使用2个连接的情况:
2011-06-30 17:55:24,047 WARN  
[com.google.code.yanf4j.core.impl.AbstractController] Add a session: 
127.0.0.1:11211
2011-06-30 17:55:24,059 WARN  
[com.google.code.yanf4j.core.impl.AbstractController] Add a session: 
127.0.0.1:11211
执行线程数:2 每个线程执行操作数:50000
Thread-12花费时间:8.589
Thread-12每秒执行:5821.399464431249
Thread-11花费时间:8.627
Thread-11每秒执行:5795.757505505969

What version of the product are you using? On what operating system?
版本是1.3.3

Please provide any additional information below.
从输出的结果看是每设置一个连接就多加一个session,这样会�
��致分布式计算的时间更长,结果是性能降低。
测试的时候可以使用更多的连接与线程,结果是连接数越多��
�慢

Original issue reported on code.google.com by csuzsl2...@gmail.com on 30 Jun 2011 at 9:57

GoogleCodeExporter commented 9 years ago
xmemcached是基于nio的,通常不要设置连接池,一个连接可以支�
��绝大多数应用。除非你的应用并发规模特别大,比如我压测
的时候测试100个线程或者300个线程并发的时候,连接池才能��
�示出优势。

连接池不要设置太大,我的建议是设置在1-30之间。这跟阻塞i
o的连接完全不一样,不能按照java memcached 
client的方式来用,动不动搞个100个连接。

Original comment by killme2...@gmail.com on 30 Jun 2011 at 10:02

GoogleCodeExporter commented 9 years ago
有没有后续反馈?没有我将关闭了。

Original comment by killme2...@gmail.com on 14 Jul 2011 at 2:24

GoogleCodeExporter commented 9 years ago

Original comment by killme2...@gmail.com on 16 Jul 2011 at 4:00