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

[loadgen] Separate into otelbench for benchmarking, otelsoak for soak testing #291

Merged
merged 52 commits into from
Jan 17, 2025

Conversation

carsonip
Copy link
Member

@carsonip carsonip commented Jan 9, 2025

Separate loadgen into otelbench and otelsoak.

otelbench

Run go benchmark on top of loadgen collector for a predefined duration -test.benchtime. otelbench accepts go benchmark flags, an otel collector config yaml, and some handy command line options to override the config. It produces go benchmark output.

Run ./otelbench -config ./config.yaml -test.benchtime=1m with ELASTIC_APM_SERVER_URL and ELASTIC_APM_SECRET_TOKEN env vars or flags.

Example output:

logs-otlp       	      16	4521329779 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	       319.2 logs/s	         0 metric_points/s	       136.5 requests/s	         0 spans/s
logs-otlphttp   	      19	3900502735 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	       370.0 logs/s	         0 metric_points/s	       158.2 requests/s	         0 spans/s
metrics-otlp    	    3584	  20884237 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	         0 logs/s	      5746 metric_points/s	       143.6 requests/s	         0 spans/s
metrics-otlphttp	    3506	  19158620 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	         0 logs/s	      6263 metric_points/s	       156.6 requests/s	         0 spans/s
traces-otlp     	      84	 730912803 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	         0 logs/s	         0 metric_points/s	       153.2 requests/s	      1034 spans/s
traces-otlphttp 	      88	 716443449 ns/op	         0 failed_logs/s	         0 failed_metric_points/s	         0 failed_requests/s	         0 failed_spans/s	         0 logs/s	         0 metric_points/s	       156.3 requests/s	      1055 spans/s

otelsoak

otelsoak is the Elastic collector components distro with an example collector config file.

@carsonip carsonip changed the title [WIP] go bench on loadgencol Load generator: otelbench for benchmarking, otelsoak for soak testing Jan 10, 2025
loadgen/manifest.yaml Outdated Show resolved Hide resolved
loadgen/config.yaml Outdated Show resolved Hide resolved
loadgen/cmd/otelsoak/main.go Outdated Show resolved Hide resolved
loadgen/cmd/otelbench/main.go Show resolved Hide resolved
loadgen/cmd/otelbench/main.go Outdated Show resolved Hide resolved
loadgen/cmd/otelbench/runner.go Outdated Show resolved Hide resolved
loadgen/cmd/otelbench/runner.go Outdated Show resolved Hide resolved
b.Fatal(err)
}
})
fmt.Printf("%-*s\t%s\n", maxLen, benchName, result.String())
Copy link
Member Author

Choose a reason for hiding this comment

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

[to reviewer] Printing to stdout as that's what go test -test.bench does. Not sure why apm-server benchtest writes to stderr (code).

Copy link
Member

Choose a reason for hiding this comment

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

I don't know either, writing to stdout seems like the right thing to do - so we can easily tee the results to a file without getting any noise from debug logs.

MaxReplay int `mapstructure:"max_replay"`
// doneCh is only non-nil when the receiver is created with NewFactoryWithDone.
// It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times.
doneCh chan TelemetryStats
Copy link
Member Author

Choose a reason for hiding this comment

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

[to reviewer] originally i started with sharing a doneCh across signals, but since it should be used when the signal's MaxReplay is reached, I've made it per-signal. It doesn't make any difference in practice now, since we benchmark per signal now, but it may be useful later when we mix signals in benchmarks.

@carsonip carsonip marked this pull request as ready for review January 16, 2025 23:10
@carsonip carsonip requested a review from a team as a code owner January 16, 2025 23:10
@carsonip carsonip changed the title Load generator: otelbench for benchmarking, otelsoak for soak testing [loadgen] Separate into otelbench for benchmarking, otelsoak for soak testing Jan 16, 2025
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Beautiful!

loadgen/README.md Outdated Show resolved Hide resolved
loadgen/cmd/otelbench/README.md Outdated Show resolved Hide resolved
loadgen/cmd/otelbench/README.md Outdated Show resolved Hide resolved
receiver/loadgenreceiver/factory.go Outdated Show resolved Hide resolved
receiver/loadgenreceiver/logs.go Outdated Show resolved Hide resolved
@carsonip carsonip requested a review from axw January 17, 2025 11:30
@carsonip carsonip merged commit e4647f2 into elastic:main Jan 17, 2025
11 checks passed
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.

2 participants