Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1659

High CPU usage with a Websocket Proxy using Undertow

XMLWordPrintable

    • 60353748

      0

      I have created a Proxy using Java's Undertow library, which redirects users websocket connections to different ports in the same computer.

      The problem is that with only 200 or 300 WebSockets connections the program starts to use a huge amount of CPU.

      I've attached JProfiler to the application, and all the threads are either in waiting or network IO state.

      The proxy server is started in the following way:

       Undertow reverseProxy = Undertow.builder()
                  .addHttpListener(80, "0.0.0.0")
                  .addHttpsListener(443, "0.0.0.0", sslContext)
                  .setIoThreads(4)
                  .setHandler(new ProxyHandler(reverseProxyServer, encodingHandler))
                  .build();
          reverseProxy.start();
      

      I'm thinking that it may be a problem of configuration, because I don't think such a CPU usage is normal.

      The colors in the threads image: yellow is waiting, light blue is net io, green is running

        1. Screenshot_10.png
          49 kB
          Federico Mouse
        2. Screenshot_11.png
          40 kB
          Federico Mouse
        3. Screenshot_13.png
          51 kB
          Federico Mouse
        4. Screenshot_14.png
          68 kB
          Federico Mouse
        5. Screenshot_16.png
          33 kB
          Federico Mouse
        6. Screenshot_18.png
          73 kB
          Federico Mouse

              flaviarnn Flavia Rainone
              federicojm Federico Mouse (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: