skip to content

How would you decide whether to run TLS on every Redis hop inside a private network, given what it costs in CPU and latency?

level: principalimportance: should knowfreq 27%

answer

  1. who else can reach this network
  2. what crosses each hop
  3. measure on your own traffic shape
  4. handshakes are a separate cost
  5. exemptions need an owner

basics

~20 s

Decide per hop from who can reach it and what crosses it, then measure the cost on your own workload. TLS lowers per-instance throughput, but the cluster bus has no other authentication, so that hop rarely earns an exemption.

solid answer

~50 s

I would not argue from the word private. Redis assumes trusted clients on a trusted network, so the question is how far I trust this one and what crosses it: `AUTH` secrets and values on client links, the whole data set on replication links, and a cluster bus with no authentication of its own. Then I measure. The docs say TLS decreases achievable throughput per instance but give no fixed number, so I run `redis-benchmark --tls` on real hardware with our pipelining and connection counts. Handshakes are a separate cost: Redis accepts one new TLS connection per event-loop cycle by default, so clients need pooling and backoff. My default is TLS on every hop wherever the network is shared. A plaintext exemption needs a dedicated segment, measured need, an owner, and for the bus an explicit `cluster-bus-port-protected-mode no`.

code

bash · 6 lines
bash
redis-benchmark -h 10.0.0.5 -p 6379 --user bench -a "$BENCH_PW" \
  -t set,get -c 200 -n 1000000 -d 512 -P 16 --threads 4

redis-benchmark -h 10.0.0.5 -p 6380 --user bench -a "$BENCH_PW" \
  --tls --cert client.crt --key client.key --cacert ca.crt \
  -t set,get -c 200 -n 1000000 -d 512 -P 16 --threads 4

go deeper

for a junior

Recall that TLS is optional, that it covers client connections, replication links and the cluster bus, and that Redis's documentation says it reduces the throughput an instance can reach.

for a middle

Name what crosses each hop in clear text, and the settings that reduce connection cost, such as tls-session-caching and the one-per-cycle limit on accepting new TLS connections.

for a senior

Design the measurement: another host, real value sizes and pipelining, plain against TLS, plus a reconnect storm. Report tail latency and headroom, and do not quote a percentage you did not measure.

for a principal

Own the standard, not the benchmark: TLS by default where a network is shared, the bus non-negotiable, and exceptions with an owner and a review trigger tied to the network's tenancy.

## The decision a lead actually owns The mechanics of TLS in Redis have right answers. Whether to pay for it on each hop does not. Redis's security model says it is designed for trusted clients in trusted environments, which leaves the real question with you: is this network trusted, by whom, and for how long? A private network that is shared with other teams, workloads or vendors is a different thing from a dedicated segment with two hosts on it. The answer is rarely the same for every hop, so decide per hop. ## What each hop puts at stake | Hop | What crosses it in clear text | What a plaintext hop allows | |---|---|---| | Client to server | Keys, values, `AUTH` passwords | Reading traffic and capturing credentials | | Replica to primary | The data set, then its writes, and `masterauth` | Reading everything in one capture | | Cluster bus | Topology and failure reports | Joining the cluster, with no credential needed | The third row differs in kind. On the first two, TLS adds confidentiality to a hop that already has `AUTH` available. On the bus, `tls-cluster` is what authenticates peers at all. Leaving it off is a decision about who may join your cluster, and it should be argued as that, not as a performance trade-off. ## What TLS costs in Redis Be precise about what is known. The documentation states that TLS adds overhead from reading and writing through an SSL connection, encryption and integrity checks, and that this decreases achievable throughput per instance. It does not give a percentage that would hold for your hardware and traffic, and neither should you. - **Record cost:** CPU per byte, so large values and replication streams feel it more than small commands would. - **Connection cost:** `max-new-tls-connections-per-cycle` defaults to 1, against 10 for plain TCP. `redis.conf` warns that raising it risks timeouts on established connections, and advises limited connection pools and exponential backoff first. A client fleet that reconnects aggressively is the worst shape for TLS. - **Session caching:** `tls-session-caching` is on by default, with 20480 sessions and a 300-second timeout, to make reconnections cheaper for clients that support it. - **Threads:** the docs say Redis supports I/O threading with TLS from 8.0, and the I/O thread code processes TLS pending data. `TLS.md` in the source tree still says it is unsupported, so do not take that note as current. - **Operations:** certificates expire, and an expired certificate is an outage. Client certificates multiply that across every application team, which is often the larger cost. ## How to measure it 1. Fix the hardware, the Redis version and `io-threads`, and use a client on another host, because a loopback run measures the loopback. 2. Use your real value sizes, pipelining and connection counts. 3. Run the same load with and without `--tls`, and compare both throughput and tail latency at your expected peak. 4. Separately, test a reconnect storm, since that is where the accept limit shows. 5. Check headroom. If the instance runs far below its limit, a real percentage loss may cost you nothing that matters. The result often moves the argument. If there is headroom, the cost objection disappears. If there is none, the honest comparison may be adding capacity against accepting the exposure. ## The options on the table | Posture | Gives you | Costs you | Fits | |---|---|---|---| | TLS everywhere, client certificates | Strongest identity on every hop | Full CPU cost, certificates for each client | Regulated data, shared networks | | TLS everywhere, `tls-auth-clients no` | Encryption plus ACL logins | Full CPU cost, server certificates only | The common middle ground | | Plain clients, TLS on replication and bus | Bus authenticated, data set protected in flight | Client traffic readable on that segment | Dedicated segment, tight headroom | | Plain on every hop | Lowest cost | Reliance on the network alone | Short-lived, low-value caches only | ## What to standardise Set the default and make the exception the thing that needs paperwork: - **Default:** TLS on every hop wherever the network is shared, with `tls-cluster` not negotiable. - **Exception:** names the segment, who else can reach it, the data's sensitivity, the measured cost, an owner and a review trigger. - **Explicit bus waiver:** a cluster that keeps a plaintext bus runs with `cluster-bus-port-protected-mode` deliberately at `no`, recorded with the firewall rule that justifies it. - **CA model:** prefer a dedicated per-cluster CA, or budget for `tls-expected-peer-name`. Revisit the decision when the network's tenancy changes. An exemption granted for a dedicated segment does not survive that segment becoming shared.

  • Someone says the private network makes TLS pointless. How do you respond?
    I ask who else can reach that network today and who could tomorrow, because a shared private network has more parties than it appears to. Then I separate the hops. For client links it may be a fair trade if the segment is truly dedicated. For the cluster bus the private network is the only authentication, so the claim amounts to saying no host on it will ever misbehave.
  • Benchmarks show TLS costs too much at peak. What are your options before dropping it?
    Check connection behaviour first, since pooling and backoff reduce handshake load, and confirm session caching is working. Try `io-threads`, which the docs support with TLS from 8.0. Then compare capacity against risk: more shards or larger hosts may cost less than the exposure. If an exemption still wins, keep TLS on the bus and replication, and record it with an owner and a trigger.

  • TLS always costs a fixed percentage, so just quote the figure
  • Traffic inside a private network never needs encrypting
  • The cluster bus is only a performance question, like the client port
  • Redis cannot use I/O threads when TLS is enabled in 8.10
  • Raising max-new-tls-connections-per-cycle is a free fix for reconnect storms

Assumes Redis 8.10; the docs state I/O threading works with TLS from 8.0, while the in-tree TLS.md still carries the older note saying it does not.