Rmi.transport.tcp.tcptransport Connectionhandler consumes a lot of CPU

I am running a third-party RMI-Server application that provides exactly one method ("getImage()" returns an image as byte[]). The implementation of this method (image acquisition through SOAP-WS) is provided by me.

The problem when starting this RMI server is the high processor consumption (measured using jvisualvm): 65% of the processor’s time goes to "sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run()" , and in second place is 15% - "sun.net.www.http.KeepAliveCache.run()" . "Real" work (image scaling) goes to 4th place. The server runs on win 2003 server. I think something is wrong with the processing of resources / connections? but is it an implementation problem or a windows configuration problem?

another observation: if the use of cpu is large, the memory usage goes up - the question arises: this is because gc cannot do its job or there are a lot of images awaiting delivery. all i can say is memory is used for byte[] .

so any ideas what to do?

thanks in advance

+4
source share
2 answers

sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.run () is a method that calls your remote implementations on the server, after sorting the arguments and before sorting the result. Temporal values ​​probably mean that it takes longer to return the image via cable as an RMI result than to scale the image.

0
source

I can only assume that the byte array can be an image, but it can be any number of things.

By the way, are you using a multi-core machine? I also have this problem, and I found that VisualVM pointed to the same culprit when using the processor at 50% on a quad-core Win7 processor and 100% on a single-core winXP. I am running Jetty for a server.

Sorry, I still can’t answer the real question, but I hope to hear the solution here or to share it soon. Since you came across this a few months ago, maybe you have already found it and can share it?

0
source

Source: https://habr.com/ru/post/895975/