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

High CPU usage with a Websocket Proxy using Undertow

    XMLWordPrintable

    Details

    • Stackoverflow ID:
      60353748

      Description

      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

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated: