On a quad core CPU machine with 4 gb ram, tomcat 6 installed, Java 1.6. we have a software who handles as communication gateway. It handles incoming Json messages using jersey (1.19), deserialize and call a client who send the message to another server using jersey (1.19) rest libraries. It handles incoming request from the other server, serialize into json and send outside. With 10 users connected, sending 600 byte of message every 4 seconds. Global cpu consumption reaches 30%. Is it a normal expected behaviour? how we can handle more users?
code:
private String executeToGameEngine(String text, String urlResource){
ClientResponse response = null;
try {
ClientConfig clientConfig = new DefaultClientConfig();
Client client = Client.create(clientConfig);
WebResource webResource = client.resource(urlResource);
response =
webResource
.accept(MediaType.TEXT_PLAIN)
.type(MediaType.TEXT_PLAIN)
.post(ClientResponse.class, text);
if (response == null) {
// error...
}
else if (response.getStatus() != 200) {
// error...
}
return response.getEntity(String.class);
}
We installed visualVM to analyze the problem, any suggestion?enter image description here