Skip to content

Commit

Permalink
Half send/receive buffer size
Browse files Browse the repository at this point in the history
Most HTTP sessions during normal browsing have a payload of a few
kilobyte, so we should be fine with smaller buffers to lower gc
pressure.
  • Loading branch information
erikvanzijst committed Aug 31, 2021
1 parent 08afbc9 commit 84e387d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel, config:
val clientAddress: SocketAddress = clientChannel.getRemoteAddress

private val clientKey = clientChannel.register(selector, SelectionKey.OP_READ, this) // client initiating the connection
private val clientBuffer = ByteBuffer.allocate(1 << 16) // client-to-server
private val clientBuffer = ByteBuffer.allocate(1 << 15) // client-to-server

private var serverKey: SelectionKey = _ // the upstream server
private var serverChannel: SocketChannel = _
private val serverBuffer = ByteBuffer.allocate(1 << 16) // server-to-client
private val serverBuffer = ByteBuffer.allocate(1 << 15) // server-to-client

private var upstreamPipe: Pipe = _
private var downstreamPipe: Pipe = _
Expand Down

0 comments on commit 84e387d

Please sign in to comment.