Skip to content

Conversation

@kawang108
Copy link
Collaborator

Summary:

  1. Check channel's writability before writing more bytes to it.
  2. Add FlushConsolidationHandler to optimize socket flushes which are expensive OS calls.

Currently we are writing to either server or client channel without first checking if the channel is writable. This can cause problems if we end up writing too fast. To improve on this, we need to check channel.isWritable before each write, and when the channel's writability changes to false, pause reading from the source channel.

We are also calling writeAndFlush for every payload that's read from the client or server (e.g., an http request is dissected into several payloads: HttpRequest, 1 or more HttpContent). The flush results in a syscall at the OS level and is usually expensive. We can optimize these calls by adding a FlushConsolidationHandler which is provided by netty in a recent minor version. This handler tries to batch multiple flushes (up to 256) into a single flush.

add FlushConsolidationHandler to optimize socket flushes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant