Skip to content
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

Add iperf output types and use it instead of go-iperf #2089

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

AbdelrahmanElawady
Copy link
Contributor

Description

go-iperf didn't have proper cleanup for temp directories created. So, it was easier to just exec the command and parse it directly instead of using it.

Changes

  • Add iperf output types
  • Run iperf directly during the task
  • Remove go-iperf

log.Error().Err(err).Msgf("failed to start iperf client with ip '%s'", clientIP)
output, err := exec.CommandContext(ctx, "iperf", opts...).CombinedOutput()
exitErr := &exec.ExitError{}
if err != nil && !errors.As(err, &exitErr) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm not sure I follow, we ignore errors other than exitErr? while that actually means we failed to execute the binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we ignore exit errors because iperf exits with a non-zero code in case it failed to run and prints the error reason in error field in JSON output. For example:

{
  "start": {
    "connected": [],
    "version": "iperf 3.14",
    "system_info": "Linux zero-os 5.10.55-Zero-OS #2 SMP PREEMPT Wed Aug 9 13:31:25 UTC 2023 x86_64"
  },
  "intervals": [],
  "end": {},
  "error": "unable to connect to server - server may have stopped running or use a different port, firewall issue, etc.: Network unreachable"
}

@@ -0,0 +1,134 @@
package perf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of having these here while they exist in go-iperf code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because go-iperf creates a temp directory in init so by importing go-iperf it would cause the same problem we are avoiding each time the task runs

Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this looks good, but my only comment is that the perf package is getting very cluttered. Can u move the iperf task into a sub package

perf
  /iperf/

since the registration of the tasks happens in noded/main this should not cause any cyclic dependency

NOTE: please also move other tasks to their own separate sub packages to perf.
so we will also have cpu and eventually public-ips

@muhamadazmy muhamadazmy merged commit 124e113 into main Oct 24, 2023
2 checks passed
@muhamadazmy muhamadazmy deleted the iperf-output-parsing branch October 24, 2023 12:21
muhamadazmy pushed a commit that referenced this pull request Oct 24, 2023
* Add iperf output types and use it instead of go-iperf

* Organize perf tasks

* Remove go-iperf tmp directories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants