0

We have a simple java application which receives commands over tcp socket (netty), translates these commands to json strings and sends them to one connected client over a websocket connection (jetty).

The application performs well with windows on different java versions. On a CentOS machine with java 1.8_121 (or 1.8_45) we noticed a delay of about 200ms between receiving the command and sending the json string.

So i tried to understand the behaviour by using JVisualVM. I startet the Application, then JVisualVM, selected the Application in JVisualVM and switched to the Tab "Profiler". I clicked on "CPU" and got an Error "Redefinition failed with error 62". Finally i closed JVisualVM.

The strange thing is that after using JVisualVM in this way the delay in my Application is gone. It reduce from about 200ms to 1ms.

Does anybody have an idea why this happens or why the code is so much faster after just starting the profiler? What can i do to run always in this faster mode?

f4n
  • 11
  • 3
  • are you using threads? or scheduled tasks? – Tschallacka Jul 25 '17 at 12:39
  • 1
    It's unlikely strangers on the internet can answer this sight unseen. Perhaps you can produce a [MCVE] that shows this behaviour. – pvg Jul 25 '17 at 12:41
  • 3
    I'm wondering about the repeatability of your experiment. How many times did you try to run the application with and without JVisualVM, and what was the average and standard deviation of the delay? – RealSkeptic Jul 25 '17 at 12:43
  • 1) netty and jetty using threads, my logic is event driven 2) i try to do, but it's more a general question if somebody seen any similar 3) i repeated the experiment 5 times on 2 different machines – f4n Jul 25 '17 at 13:43
  • if i use Xverify:none ( described here: [link](https://stackoverflow.com/questions/26834651/redefinition-failed-with-error-62-while-trying-to-profile-an-application) ) to avoid the error it isn't faster – f4n Jul 25 '17 at 13:47
  • 200 ms? Could it be something like https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Forcing_data_delivery? – maaartinus Jul 26 '17 at 05:41
  • i found the problem leading to the delay, it was a misconfigured logback. i had a console appender and a file appender. the console output was piped to the same file as the file appender. but i still don't understand why the failed profiling is boosting performance (or disabling something in logback)? – f4n Jul 31 '17 at 06:17

0 Answers0