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

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

问题描述

我正在创建一个使用libev的负载测试器,以创建与我正在处理的应用程序的许多打开的tcp连接.由于没有文件限制,目前它以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天全站免登陆