如何增加 osx 上的套接字限制以进行负载测试? [英] How to increase limits on sockets on osx for load testing?

查看:27
本文介绍了如何增加 osx 上的套接字限制以进行负载测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个负载测试器,它使用 libev 创建大量与我正在处理的应用程序的开放 tcp 连接.由于 nofiles 限制,目前它在 256 个连接时爆炸:

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 limit:

ulimit -n
256

我可以通过执行以下操作将其增加到 1024:

I can increase this to 1024 by doing the below:

ulimit -n 1024

但我不能进一步增加它.理想情况下,我想将其设置为 1048576.它给出了以下错误:

But i cannot increase it further. Ideally i want to set it to 1048576. It gives the following error:

ulimit: open files: cannot modify limit: Invalid argument

如何在 osx 上进一步增加 ulimit?

How can i increase the ulimit further on osx?

推荐答案

(答案更新为使用 -S 作为几个评论者的建议)

(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

这篇关于如何增加 osx 上的套接字限制以进行负载测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆