Skip to content

Connection Internals

Mark Paluch edited this page Jan 7, 2022 · 6 revisions

Connections and netty connection events in Lettuce are handled by a chain of channel handlers.

  • Channel Initializer

  • SSL Handler (for SSL connections)

  • Channel Activator

  • Connection Watchdog (Reconnect)

  • Channel Group Listener (register channels in a channel group)

  • Command Handler (buffering commands/reply state machine/encode commands to channel)

  • Connection (command trigger, external command control by Lettuce users)

Connecting to Lettuce has four phases:

  1. Not connected

  2. Connected to channel (usually triggered by connect(), the TCP channel is open)

  3. Connection initialized (e. g. SSL Handshake done or channelActive() on plain connections)

  4. Ready to use (login/select commands will be issued and connection returns on success)

The same flow applies on reconnect.

Each allocated connection pre-allocates a buffer of 65kb for response processing.

Connect Plain

Connect%20Plain

Connect SSL

Connect%20SSL

Reconnect

Reconnect

Close Connection

Close

Clone this wiki locally