简体   繁体   English

java.io.IOException:打开的文件过多,kafka-rest代理

[英]java.io.IOException: Too many open files kafka-rest proxy

I am using confluent kafka platform . 我正在使用融合的kafka平台。 I have a topic with 4 partition and replication factor of 2. Single zookeeper, three brokers and kafka-rest proxy server. 我有一个主题,其4分区和复制因子为2。单个zookeeper,三个代理和kafka-rest代理服务器。 Now I am load testing the system with siege running 1000 users with a list of api which in turn hit kafka producer. 现在,我正在用1000个带有api列表的围攻来运行系统的负载测试,这些api反过来又会影响kafka生产者。 I have my producer and consumer using the rest proxy ( kafka-rest ). 我有我的生产者和消费者使用rest代理( kafka-rest )。 I am getting following issue: 我收到以下问题:

{ [Error: getaddrinfo EMFILE] code: 'EMFILE', errno: 'EMFILE', syscall: 'getaddrinfo' }

In kafka-rest log I can see: 在kafka-rest日志中,我可以看到:

[2016-02-23 07:13:51,972] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  14 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,973] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  15 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,974] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  12 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,978] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  6 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,983] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  6 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,984] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  4 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,985] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  7 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,993] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  3 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,994] INFO 127.0.0.1 - - [23/Feb/2016:07:13:51 +0000] "POST /topics/endsession HTTP/1.1" 200 120  4 (io.confluent.rest-utils.requests:77)
[2016-02-23 07:13:51,999] WARN Accept failed for channel java.nio.channels.SocketChannel[closed] (org.eclipse.jetty.io.SelectorManager:714)
java.io.IOException: Too many open files
    at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
    at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processAccept(SelectorManager.java:706)
    at org.eclipse.jetty.io.SelectorManager$ManagedSelector.processKey(SelectorManager.java:648)
    at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:611)
    at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:549)
    at org.eclipse.jetty.util.thread.NonBlockingThread.run(NonBlockingThread.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)

So I went through a lot of questions related to this. 所以我经历了很多与此有关的问题。 Set my ec2 machine paramenters so that I dont get too many open file error . 设置我的ec2机器参数,这样我就不会出现too many open file error But its not solved. 但是它没有解决。 I have reduced the TIME_WAIT to 30 seconds. 我将TIME_WAIT减少到30秒。 ulimit -n is 80000. ulimit -n是80000。

I have collected some stats and look like kafka rest proxy which is running on `localhost:8082 causing too many connections. 我已经收集了一些统计信息,看起来像是在`localhost:8082上运行的kafka rest代理,导致了太多连接。 How do I solve this issue? 我该如何解决这个问题? Also sometimes when error is coming and then I stop my siege test but again when TIME_WAIT connections are reduced, I restart my load test with 1 user only still I see the same issue. 另外有时,当错误来临时,我停止了攻城测试,但是当TIME_WAIT连接减少时,我仅以1个用户重新启动负载测试,但仍然看到相同的问题。 Some issue in rest proxy wrapper for node js? 节点js的REST代理包装中存在问题?

` `

You need to increase the ulimit for that process. 您需要增加该过程的ulimit。 In order to check the ulimit for a particular process , run this: sudo cat /proc/< process_id >/limits 为了检查特定进程的ulimit,请运行以下命令:sudo cat / proc / < process_id > / limits

in order to increase the ulimit for process running via supervisord, you can increase minfds in supervisord.conf 为了增加通过supervisor运行的进程的ulimit,可以在supervisor.conf中增加minfds

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM