I have a problem with open files under my Ubuntu 9.10 when running server in Python2.6 And main problem is that, that i don't know why it so..

在运行Python2.6版本的服务器时,我在Ubuntu 9.10下有一个打开文件的问题,主要的问题是,我不知道为什么会这样。

I have set

我已经设置

ulimit -n = 999999

ulimit - n = 999999

net.core.somaxconn = 999999

net.core。somaxconn = 999999

fs.file-max = 999999

fs。file-max = 999999

and lsof gives me about 12000 open files when server is running.

lsof在服务器运行时向我提供12000个打开文件。

And also i'm using epoll.

我还用了epoll。

But after some time it's start giving exeption:

但过了一段时间后,它开始给人感觉:

File "/usr/lib/python2.6/socket.py", line 195, in accept error: [Errno 24] Too many open files

文件“/ usr / lib / python2.6 /插座。第195行,accept error: [Errno 24]打开的文件太多

And i don't know how it can reach file limit when it isn't reached.

我也不知道当它没有达到文件限制时,它是如何达到文件限制的。

Thanks for help)

谢谢你的帮助)

2 个解决方案

#1


20

Params that configure max open connections.

配置最大打开连接的参数。

at /etc/sysctl.conf

在/etc/sysctl.conf

add:

添加:

net.core.somaxconn=131072
fs.file-max=131072

and then:

然后:

sudo sysctl -p

at /usr/include/linux/limits.h

在/usr/include/linux/limits.h

change:

变化:

NR_OPEN = 65536

at /etc/security/limits.conf

在/etc/security/limits.conf

add:

添加:

*                soft    nofile          65535
*                hard    nofile          65535

更多相关文章

  1. Python之错误异常和文件处理
  2. python解析json文件读取Android permission说明
  3. python 之 logger日志 字典配置文件
  4. [置顶] Python + C/C++ 嵌入式编程(1):多维数组Numpy.Array(
  5. 使用python api递归计算每个Dropbox文件夹大小
  6. 如何在python中播放wav文件?
  7. python多线程文件传输范例(C/S)
  8. Python - 将值打印到新文件?
  9. 如何让TkInter文件选择对话框与IPython / Spyder一起使用?

随机推荐

  1. Python 依赖库管理哪家强?pip、pipreqs、p
  2. 为什么要翻译?值得坚持下去么?
  3. Python 中 -m 的典型用法、原理解析与发
  4. Python 的整数与 Numpy 的数据溢出
  5. Python 进阶之源码分析:如何将一个类方法
  6. Web UI自动化测试之元素定位
  7. 我的 2019 年 Python 文章榜单
  8. android sqlite SQLiteDatabase 操作大全
  9. 开发者请注意:Python2 的最后版本将于 4
  10. Python 之父的解析器系列之六:给 PEG 语法