Introduce SlowOpenToxic to approximate the TCP handshake latency#536
Open
stribioli wants to merge 4 commits intoShopify:mainfrom
Open
Introduce SlowOpenToxic to approximate the TCP handshake latency#536stribioli wants to merge 4 commits intoShopify:mainfrom
stribioli wants to merge 4 commits intoShopify:mainfrom
Conversation
Introduce a new toxic (`slow_open` / `SlowOpenToxic`) that adds a delay to the first data packet of a new TCP connection. This simulates the delay affecting the TCP handshake (SYN + SYN/ACK), which is not covered by the `latency` toxic.
Also: improve tests for latency toxic to check that every packet is subject to the added latency.
Author
|
I have signed the CLA! |
|
THe workaround can be sufficient for my need. I need this so badly :) |
Well I will probably build it locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in #123, the TCP handshake is performed by the kernel, so toxiproxy cannot inject latency there. Therefore, effects of latency on connection timeouts cannot be tested using this tool.
However, a user might be interested in the overall effects of latency from an application point of view. That is, the end-to-end effect on an entire conversation (TCP connection, application request, application response).
Using the
LatencyToxiconly, this end-to-end effect is not accurately modeled, because the initial RTT would be missing.This pull request introduces a new toxic,
SlowOpenToxic, that simulates the handshake latency by adding a delay to the first data packet only. I hope you'll find it useful!Latencies breakdown
In reality, you would have:
Using Toxiproxy, with a
SlowOpenToxicand aLatencyToxic(with the same delay, equal to 1 RTT), you would have:SlowOpenToxicand 1-RTT delay added byLatencyToxic)LatencyToxic).Implementation notes
LatencyToxic. Once the first packet has been processed, a persisted State records the event and makes the toxic warm. From that point, this toxic is transparent.LatencyToxictests (doLatencyRound) in order to:SlowOpenToxictests.LatencyToxicandSlowOpenToxic. To do this, I also tweaked the harness (at toxic_test.go:69) to process multiple packets, instead of stopping at the first one.