-
Notifications
You must be signed in to change notification settings - Fork 117
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
Benchmark stream command #1584
Benchmark stream command #1584
Conversation
For now, it is really nice that it runs just all tracks. I expect eventually we need to have something like "default" tracks but we can put that for later.
ticker seems to be very Golang specific. Ideas for alternative names? I did a quick run of the code, so far all looks good 🎉 |
? |
Is it possible to configure the stream command to ship data to a cluster not started with elastic-package? I assume the env variables could be adjusted and it would just work 🤔 |
indeed:
|
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.
I have been thinking more about our conversation around the naming. One thing I realised that might be obvious is that if multiple benchmarks are run in parallel, all of them will have the same ticker period. And the config is per benchmark. Lets assume I have the following config and 2 benchmarks exist:
--ticker-duration: 10
--events-per-ticker: 1
I assume this sends 2 events, 1 for each benchmark, every 10 seconds. The ticker duration reminds me a lot of the period
config in Metricbeat. And the second is then events-per-period
? I would stay away from bulk-request as it would also be ok, if we don't use bulk requests :-) Maybe exchange period with duration?
An alternative config would be --events-per-second=0.1
. This would ship one event every 10 seconds. Is this more consumable?
Also we should have defaults for all configs, so if they are skipped it just works. For example if we stick to the previous configs, have 10s period as default and 1 event per 10s.
it's better because we have only one flag, but it's rather tricky to express period duration where you want resolution of minutes, I would keep the two different flags, and just rename them |
Ok, lets go with this for now. We have now quite a list of command and flags, as soon as things settle down a bit more there is an opportunity to look at all flags together and unify / standardise / cleanup where we can. |
You can stream data to a remote ES cluster setting the following environment variables: | ||
|
||
ELASTIC_PACKAGE_ELASTICSEARCH_HOST=https://my-deployment.es.eu-central-1.aws.foundit.no | ||
ELASTIC_PACKAGE_ELASTICSEARCH_USERNAME=elastic |
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.
Do API keys work here? Serverless has mostly API keys
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.
no, it doesn't https://github.com/elastic/elastic-package/blob/main/internal/stack/clients.go#L22-L25
but it should be possible to run something like:
elastic-package stack up --provider serverless
$(elastic-package stack shellinit)
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.
@jsoriano Seems like a missing feature in elastic-package? Should we open an issue?
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.
Yes, this is missing, please create an issue.
BenchStreamPeriodDurationFlagName = "period-duration" | ||
BenchStreamPeriodDurationFlagDescription = "duration of the period between each ingestion cycle: expressed as a positive duration" | ||
|
||
BenchStreamPerformCleanupFlagName = "perform-cleanup" |
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.
The part I stumbled into, this does not only cleanup at the end, but it also does cleanup on start. Is this expected?
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.
yes, it is intended: I thought it might be useful if I changed the template and wanted to compare data before and after
while indeed, since now backfill
has a default value, we will have duplicated data for the last 15 minutes.
I can change to avoid cleanup only in the end, but to do it on start
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.
On the fence about this one. As now perform-cleanup
is not the default anymore, I think it is less of an issue. Lets see how it is used and come back to this but leave it for now.
internal/cobraext/flags.go
Outdated
@@ -65,6 +65,21 @@ const ( | |||
BenchCorpusRallyUseCorpusAtPathFlagName = "use-corpus-at-path" | |||
BenchCorpusRallyUseCorpusAtPathFlagDescription = "path of the corpus to use for the benchmark: if present no new corpus will be generated" | |||
|
|||
BenchStreamBackFillFlagName = "backfill" | |||
BenchStreamBackFillFlagDescription = "amount of time to ingest events for since starting from now: expressed as a negative duration" |
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.
The description is very clear, but of course I put in 1m
at first.
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.
It is indeed a bit weird to have a parameter that only accepts negative numbers. Could we revert it, so it accepts only positive numbers and we negate it in code?
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.
Code LGTM
As a follow up, I think there is some potential to refactor / cleanup but we can take this separate.
Generator *generator `config:"generator" json:"generator"` | ||
} | ||
|
||
type generator struct { |
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.
This seems to be almost the same as https://github.com/elastic/elastic-package/blob/main/internal/benchrunner/runners/rally/scenario.go, same for other objects. Is the duplication on purpose?
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.
+1, we should probably try to reduce duplication, there is quite a lot between benchmark runners. This would also help to evaluate better how much logic to maintain we are adding with each runner.
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.
yes, let's plan for another PR moving repeated code to some common package under benchmark
@aspacca Is there a way we could have tests for these features |
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.
Mostly looks good to me. Added a comment about ignoring the error in one flag, and some other questions that would not be blockers before merging.
Generator *generator `config:"generator" json:"generator"` | ||
} | ||
|
||
type generator struct { |
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.
+1, we should probably try to reduce duplication, there is quite a lot between benchmark runners. This would also help to evaluate better how much logic to maintain we are adding with each runner.
internal/cobraext/flags.go
Outdated
@@ -65,6 +65,21 @@ const ( | |||
BenchCorpusRallyUseCorpusAtPathFlagName = "use-corpus-at-path" | |||
BenchCorpusRallyUseCorpusAtPathFlagDescription = "path of the corpus to use for the benchmark: if present no new corpus will be generated" | |||
|
|||
BenchStreamBackFillFlagName = "backfill" | |||
BenchStreamBackFillFlagDescription = "amount of time to ingest events for since starting from now: expressed as a negative duration" |
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.
It is indeed a bit weird to have a parameter that only accepts negative numbers. Could we revert it, so it accepts only positive numbers and we negate it in code?
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.
I think we need to handle the error in the flag, as we do with all other flags. For the rest it LGTM.
I don't want to return an error if there is some type conflict, I want the consumer of the command to be able to see the command running with the default value without any error. :) but we can warn the user with a log entry :) |
Co-authored-by: Jaime Soriano Pastor <[email protected]>
💚 Build Succeeded
History
cc @aspacca |
Similarly to
benchmark rally
command we want to generateschema-b
documents for a given integrations.Instead of creating a rally track out of them we will stream them, according to a configurable rate, directly to an ES cluster, using bulk requets
see #1541 for more context
usage (from a package root):
or
or
flags:
--benchmark
: run a specific benchmark, if not present all benchmarks for a packages will be run--backfill
: negative duration to backfill events ingestion for, if not present event will be ingested since now--period-duration
: time between each bulk request--events-per-period
: events on each bulk request--timestamp-field
: field from generator config used for@timestamp
event's field (default "timestamp": it is required for backfill and overridingperiod
settings)--perform-cleanup
: passing this flag will delete documents in the streaming data streams before and after the streaming, as well as uninstalling the integration at the end