Skip to content

Sending messages via WebSocketOutputStream is slow #4000

Open
@michbin

Description

@michbin

Describe the bug
Sending messages through the WebSocketStreamHandler.WebSocketOutputStream is quite slow. This behavior is mainly caused by the flush() method. We often observed that flush() only returned after 100 ms which reduced the throughput significantly.

The root cause is the long wait time (100 ms!) in following code snippet:

      while (WebSocketStreamHandler.this.socket.queueSize() > 0) {
        try {
          Thread.sleep(100);
          ...

Client Version
19.0.1

Kubernetes Version
1.29

Java Version
Java 17

To Reproduce
Invoke Exec.exec(...) to create an ExecProcess.
Use the output stream returned by Process.getOutputStream().
Send data using write(...) calls and flush the stream afterwards.

Expected behavior
A wait time of 1 ms should be sufficient.

Server (please complete the following information):

  • OS: Linux and Windows
  • Environment: container and IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions