mac修改open files数目
来源:互联网 发布:c语言 原版书 编辑:程序博客网 时间:2024/05/22 11:31
上午在进行压力测试的时候,因为开启线程爬虫太多,所以在tcp连接的时候太多了,故一直出现tcp : too many open files的情况,查了一下,原来是系统开启文件数有限制。
树霉派上面的同事已经设置好了,然后程序是在自己的mac上运行的,所以还得把自己的open files数目设置一下。
上网找了好多解决方案,都没有有用的。最后快要放弃的时候找到一个:http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/#Mac-OS-X
因为自己的mac是Mac OS X Yosemite,里面正好有这个的解决方案,试了一下,可以修改open files数目成功!
解决方案如下:
输入命令:launchctl limit
可以看到类似这样:
maxproc表示的是开启的最大进程数,第一个1064表示的是soft限制,第二个1064表示的是hard限制,即硬件最大的限制数,自己设置的不能高于hard限制。所以 我soft也改成了1064最大的。
maxfiles表示的是开启的最大文件数(句柄),意义同上……
如何设置呢?下面讲重点:
打开或者新建一个文件:/Library/LaunchDaemons/limit.maxfiles.plist
输入:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>limit.maxfiles</string> <key>ProgramArguments</key> <array> <string>launchctl</string> <string>limit</string> <string>maxfiles</string> <string>65536</string> <string>65536</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceIPC</key> <false/> </dict> </plist>保存并重启mac即可设置最大文件数。
打开或者新建一个文件:/Library/LaunchDaemons/limit.maxproc.plist
输入:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>limit.maxproc</string> <key>ProgramArguments</key> <array> <string>launchctl</string> <string>limit</string> <string>maxproc</string> <string>2048</string> <string>2048</string> </array> <key>RunAtLoad</key> <true /> <key>ServiceIPC</key> <false /> </dict> </plist>保存并重启mac即可设置最大进程数。
0 0
- mac修改open files数目
- Linux上修改open files数目
- Linux上修改open files数目
- linux修改open files数
- MAC 下mongo db 报 too many open files
- linux有效修改max open files/ulimit -n
- 修改linux的open files数(ulimit -n)
- Linux中修改openfile大小(max open files/ulimit -n )
- linux修改最大文件链接数open files/ulimit -n
- linux有效修改max open files/ulimit -n
- too many open files
- too many open files
- To many open files
- Too many open files
- too many open files
- lsof(list open files)
- Too many open files
- too many files open
- hdu 5367 digger(线段树)
- Android 2D Graphics学习(二)、Canvas篇1、Canvas基本使用
- Leet——code 刷题_顺序
- json中null的处理
- MATLAB 求解符号表达式数值的方法:subs函数
- mac修改open files数目
- android在apk中获取root权限,并执行命令(改变文件权读写限)
- pdf如何转换成txt的方法分享
- 利用Jenkins+Gitlab搭建持续集成(CI)环境
- [ReactNative入门到精通]React Native概述
- Linux 下监测网速的测试接口 --已经测试单位为byte=8bit
- 编程式事务
- svn: Working copy xxx is too old (format 10, created by Subversion 1.6)
- 黑马程序员——C语言中的printf函数