title: Too many open files exception on AwS machine with high configuration
body: <p>My sincere apologies if the question is stupid but I am a novice here (front end developer, recently working on backend).  </p>
  
  <p>I have my app running on Amazon aws machine. What I want is to efficiently utilize my resources so that more requests are served.</p>
  
  <p>I am running a Java vertx server that serves GET and websocket request. I have created three instances of this server running on different port and balanced the load using nginx.</p>
  
  <p>My aws resource is pretty much</p>
  
  <pre><code>lsblk
  NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
  xvda    202:0    0   100G  0 disk 
  └─xvda1 202:1    0   100G  0 part /
  </code></pre>
  
  <p>My soft limit is unlimited</p>
  
  <pre><code>ulimit -S
  unlimited
  </code></pre>
  
  <p>My hard limit is unlimited</p>
  
  <pre><code>ulimit -H
  unlimited
  </code></pre>
  
  <p>I am checking the total number of opened files as</p>
  
  <pre><code>sudo lsof -Fn -u root| wc -l
  13397
  </code></pre>
  
  <p>Why am i getting this exception</p>
  
  <blockquote>
    <p>java.io.IOException: Too many open files</p>
  </blockquote>
  
  <p>My ulimit -a is</p>
  
  <pre><code>core file size          (blocks, -c) 0
  data seg size           (kbytes, -d) unlimited
  scheduling priority             (-e) 0
  file size               (blocks, -f) unlimited
  pending signals                 (-i) 128305
  max locked memory       (kbytes, -l) 64
  max memory size         (kbytes, -m) unlimited
  open files                      (-n) 700000
  pipe size            (512 bytes, -p) 8
  POSIX message queues     (bytes, -q) 819200
  real-time priority              (-r) 0
  stack size              (kbytes, -s) 8192
  cpu time               (seconds, -t) unlimited
  max user processes              (-u) 128305
  virtual memory          (kbytes, -v) unlimited
  file locks                      (-x) unlimited
  </code></pre>
  
  <p>What is the best way to check the number of available files and also the number of files that are used. And how should I use the resources in such a way that I can make large number of connections.</p>
  
  <p>Please let me know.</p>