There is a web project, with each request (and there are tens of thousands per day), something like this happens:
скачивается некоторый файл по ссылке в файл -> файл считывается -> происходит некая программная обработка, сохраняется в другой файл -> происходит ещё одна обработка -> я отправляю запрос, где результативный файл прикрепляется в multipart/form-data Total three files: downloaded (via FileUtils.copyURLToFile ), converted to the desired format (I work with audio files) and processed file (effective, which I send).
Or I receive a request -> I generate it myself and save the file -> process it and load it.
It turns out at least 2 files, maximum 3. The error began to appear:
Jul 29, 2017 7:38:05 PM org.apache.tomcat.util.net.NioEndpoint$Acceptor run SEVERE: Socket accept failed 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.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:682) at java.lang.Thread.run(Thread.java:748) I already asked a similar question ( Too many open files on tomcat server, tomcat 9 ), but there was only one file for each question, and all I had to do was read all the files into a string, but now I don’t know how to do in this situation. Do not save the files is unlikely to succeed, and I do not really understand how to apply try-with-resources here. I would be grateful for the help.
Increasing the limits also failed: ( https://askubuntu.com/questions/941031/sysctl-etc-security-limits-conf55-invalid-syntax-continuing ), I tried to do ulimit -n 8192 , now with ulimit -n and 8192 displayed, but I'm not sure that it works as it should.
mp3format, convert it towavusingjavazoom jlayer, process it with the help of thesoniclibrary, then load and send it. Either I get the text, generate a voice recording from it usingamazon polly, convert again, process it with the same library and load it again. If I could do all this without saving anything in the files, it would be excellent, but I don’t know, to be honest, how to do it, because I’m notjlayerthe samejlayerlibraryjlayerthat itjlayernot a file, but a stream of bytes . With other libraries as well. - Peter Samokhin