|
楼主 |
发表于 2007-12-19 21:55:36
|
显示全部楼层
也作了和buckwen同样的测试,结果一样,按照http://www.riverace.com/ace-linux.htm的说法:
Using More Than 1024 Network Handles
The maximum number of handles that can be used with select() varies across platforms, but with Linux kernels, it's 1024 by default. For many applications, this is too low, reducing the scalability of applications using select()-based reactor implementations (ACE_Select_Reactor and ACE_TP_Reactor). When you need to increase the number of handles, follow these steps (this works for at least 2.4 kernels as reported by one customer... your mileage may vary):
Change the value of __FD_SETSIZE to the maximum you want. This value should be changed in:
/usr/include/bits/typesizes.h
/usr/include/bits/nptl/typesizes.h
/usr/include/linux/posixtypes.h
Rebuild the kernel.
Rebuild ACE.
Make sure that /proc/sys/fs/file-max (total number of files that can be opened by all users) is large enough. To check, you can: cat /proc/sys/fs/file-max
If you need to increase it, modify /etc/sysctl.conf and add: fs.file-max = <some big number> and then execute sysctl -p. Most likely you will not have to make any changes here.
Edit /etc/security/limits.conf and add: <user name> hard nofile <the handle limit you want> (no larger than the __FD_SETSIZE value from above).
Login as user specified in previous step and execute ulimit -n 2048. At this point kernel will allow any process in current session to open 2048 handles. To check what are your limits you can always use ulimit -a. Since this setting will be valid only for this session, you can add ulimit -n 2048 to your .profile or .bash_profile if the permanent setting is required.
好像没用。
另外,采用Dev_Poll好像也是1000多个。
winston有没有试过? |
|