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?