How to increase limits on sockets on osx for load testing?

前端 未结 3 548
轮回少年
轮回少年 2020-12-04 07:23

I\'m creating a load tester that uses libev to create lots of open tcp connections to an app i\'m working on. Currently it bombs out at 256 connections, due to the nofiles l

相关标签:
3条回答
  • 2020-12-04 07:56

    Try running as root (e.g. do a "sudo -s" before running the ulimit command and your program).

    Note that I'm not sure that 1-million-plus TCP sockets at once is realistically achievable (although I'm interesting in hearing about what happens when you try it ;^))

    Also, check out this.

    0 讨论(0)
  • 2020-12-04 08:01

    (answer updated to use -S as several commenters suggested)

    $ sysctl kern.maxfiles
    kern.maxfiles: 12288
    $ sysctl kern.maxfilesperproc
    kern.maxfilesperproc: 10240
    $ sudo sysctl -w kern.maxfiles=1048600
    kern.maxfiles: 12288 -> 1048600
    $ sudo sysctl -w kern.maxfilesperproc=1048576
    kern.maxfilesperproc: 10240 -> 1048576
    $ ulimit -S -n
    256
    $ ulimit -S -n 1048576
    $ ulimit -S -n
    1048576
    
    0 讨论(0)
  • 2020-12-04 08:03

    One more thing: Limit on ports is 65535. So you may not get as many as you want to.

    0 讨论(0)
提交回复
热议问题