I have been doing load testing for my REST APIs using JMeter.
I am getting the following error when hit with 1000 concurrent users:
Too many open files. Stacktrace follows:
java.net.SocketException: Too many open files
at java.net.Socket.createImpl(Socket.java:397)
at java.net.Socket.getImpl(Socket.java:460)
at java.net.Socket.setSoTimeout(Socket.java:1017)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:126)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:476)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:441)
at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:390)
My server tries to hit another REST API to get the data and process it and finally return a JSON response.
How do I increase the number of open files in Linux?
Following is the call I am making to another server
Map getResponse(Map data, String url){
HTTPBuilder httpBuilder = new HTTPBuilder(url);
httpBuilder.request(Method.POST, JSON) {
headers.'Authorization' = AppConfig.config.appKey;
headers.'Content-type' = 'application/json'
body = data
response.success = { resp, reader ->
return reader as Map;
}
response.failure = { response, reader ->
return null
}
}
}