开发者

Is there a limitation on the number of sockets being used in any application?

Is there a limitation on the number of sockets being used in any application? In our application for record locking purpose we are handling all the connec开发者_运维百科ted users in a middle layer which sometimes get crashed when more number of users are connected to that.


There is a limit of open files per process (that include sockets). You can check it by ulimit -n


Yes, there is a soft and hard limit (at least on Unix) see the getrlimit() and setrlimit() calls to check.


On linux, you can view the limits using ulimit -a:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 15347
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

As a1ex07 mentioned, the limit in this case is 1024, although it can be adjusted. This article has some more information on performance tuning that might be of interest.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜