-
Notifications
You must be signed in to change notification settings - Fork 3
Adding delay cells that can reorder packets #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BobAnkh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxime-bruno We really appreciate your contributions and your overall design! However, there remain some points to be discussed besides the changes requested:
- Naming conventions: Could you please rename the
reorder_delayorReorderDelayjust toreorderorReorderfor simplicity? For our design choice to choose delay as our trace definition, we can add some words in documentations. Additionally, could you please rename theDelayGeneratortrait toReorderTraceand its method tonext_delayto ensure compatibility with other trace traits in our crate? - Could you please remove the file
.pre-commit-config.yaml? - For the
DelayGenerator(orReorderTraceas I expected) trait (and its specific models, normal or log normal), I will move it out of this crate to cratenetem-tracein the near future, as we did with other cells for decoupling. You can also do this directly by sending a PR to that codebase if you prefer. - Could you please add a demo configuration section to the file
config.example.toml? - Could you please add a test for correctness verification to
tests/integration, similar to what we did for other cells? - For the definition of
ReorderCellBuildConfig, I do think we can change it to be similar toDelayReplayCellBuildConfig. In this way, we can easily extend reorder trace with more models beside normal or log normal in other crates (i.e.,netem-trace) without modifying rattan. If you want to preserve some of them for simpler configuration, you can also add a newReorderReplayCellBuildConfigstruct.
|
Hi, It seems that most of your requests are pretty logical, I just have a few points:
|
|
Hi, For your concerns:
I can explain more details to you. For all such cells, it will replay a so-called
While it may technically replace the Feel free to let me know if you have any further thoughts or concerns. I can also assist with some of the implementations. |
|
So the replay cell would be a cell with a set of laws with their seed and at which moment switching from one to another ? |
|
In detail, the replay cell is a cell that contains a trait object, which produces a sequence. As you can see the pub struct BwReplayCellConfig<P, Q>
where
P: Packet,
Q: PacketQueue<P>,
{
pub trace_config: Option<Box<dyn BwTraceConfig>>,
pub queue_config: Option<Q::Config>,
pub bw_type: Option<BwType>,
}or the pub struct BwReplayCellEgress<P, Q>
where
P: Packet,
Q: PacketQueue<P>,
{
egress: mpsc::UnboundedReceiver<P>,
bw_type: BwType,
trace: Box<dyn BwTrace>,
packet_queue: Q,
current_bandwidth: Bandwidth,
next_available: Instant,
next_change: Instant,
config_rx: mpsc::UnboundedReceiver<BwReplayCellConfig<P, Q>>,
send_timer: Timer,
change_timer: Timer,
state: AtomicI32,
}So that we have different models implementing For an example usage, see tests/integration/bandwidth.rs#L773: let trace = RepeatedBwPatternConfig::new()
.pattern(vec![Box::new(StaticBwConfig {
bw: Some(Bandwidth::from_mbps(1)),
duration: Some(Duration::from_secs(10)),
}) as Box<dyn BwTraceConfig>])
.build();
BwReplayCell::new(
Box::new(trace) as Box<dyn BwTrace>,
DropTailQueue::new(DropTailQueueConfig::new(100, None, BwType::default())),
None,
) |
|
One more thing to add: the definition of |
|
So a proper implementation of what I called DelayGenerator would be /// This is a trait that represents a trace of per-packet delays.
///
/// The trace is a sequence of `delay`.
/// The delay describes how long the packet is delayed when going through.
///
/// For example, if the sequence is [10ms, 20ms, 30ms],
/// then the delay will be 10ms for the first packet, then 20ms for second, then 30ms for third.
///
/// The next_delay function either returns **the next delay**
/// in the sequence, or **None** if the trace goes to end.
pub trait DelayPerPacketTrace: Send {
fn next_delay(&mut self) -> Option<Delay>;
}
|
|
Yes, I agree entirely with your design and implementation. It's just a matter of whether to call it |
|
I have published a new version of |
…gs to netem-trace)
|
As requested I made several changes (most of the requested ones):
To be done:
|
|
So normally I'm finished, I just have to make a PR for I'm waiting for your reviews before making the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes are great! In addition to the requested changes, here are some requirements regarding cleaning up the commit history that you can refer to and modify before the final merge:
- Can you avoid modifying the svg figures inside assets? This makes the PR a little messy.
- And could you seperate the style format of files(e.g., devcontainer.json, .sockerignore, .github/workflows, ci/images) into a single commit in this PR so that I can easily maintain a clear git history?
- If you want to squash the commits in the PR (into two, one main feature and the other formatting) according to our commit conventions before merging, you can wait for my final commit message requirements. If you prefer me to handle it directly, you can change the target branch to the dev branch I newly created, and I will rebase after merging this PR.
|
Seems doable The modification to assets and things like that are just trailing whitespace and missing new lines, I'll make a clean commit for that For squashing the commits, I'll let you handle it to be sure it has the names you want, or if you need me to split commits, for features separation, I'll do it |
Then it's fine to include them in this PR as a separate commit.
You can commit whatever you want for now, and we will handle this just before the merging process. For the final history, I expect there to be two squashed commits, one for all the features and the other for the style format (i.e., the trailing whitespaces or new lines, etc.). I will provide you with the commit message I need for the two commits before the merge, and you can assist me in rebasing the commit history so that I can merge them directly into the main branch. |
|
Hi, Normally everything is done, I just have to push a PR for |
BobAnkh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Normally everything is ready |
|
I did not test this part and just noticed this issue The fact that the |
Ok, can you send me a new PR to fix this issue? I think we may have some serde option to change this behavior (maybe something similar to |
Adds a new cell
ReorderDelayCell.This cell takes a delay generator. The packets are delayed in a way (priority queue) that allows potential reordering.
I added support for :
It can be a potential solution for issue #32
I also added benchmarks to test the bandwidth, delay, and reorder delay cell.