-
Notifications
You must be signed in to change notification settings - Fork 585
archive perf test #17522
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
base: compatible
Are you sure you want to change the base?
archive perf test #17522
Conversation
!ci-build-me |
1 similar comment
!ci-build-me |
a29563f
to
00f0d43
Compare
!ci-build-me |
1 similar comment
!ci-build-me |
7991eca
to
dd174be
Compare
!ci-build-me |
!ci-build-me |
5 similar comments
!ci-build-me |
!ci-build-me |
!ci-build-me |
!ci-build-me |
!ci-build-me |
scripts/benchmarks/lib/bench.py
Outdated
@@ -444,6 +445,72 @@ def parse(self, content, output_filename, influxdb, branch): | |||
|
|||
return [output_filename] | |||
|
|||
class ArchiveBenchmark(Benchmark): | |||
""" | |||
Concrete implementation of Benchmark for ledger test apply benchmark. |
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.
Confused, is this "ledger test apply" or "archive" benchmark?
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.
Copy paste 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.
Could you fix the name, then?
!ci-build-me |
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.
Approving.
However, if this is one of the minority places we use InfluxDB in our CI, I'd consider removing InfluxDB as a whole and replace everything with Grafana, so to simplify our already complicated tech-stack
scripts/benchmarks/lib/bench.py
Outdated
@@ -444,6 +445,72 @@ def parse(self, content, output_filename, influxdb, branch): | |||
|
|||
return [output_filename] | |||
|
|||
class ArchiveBenchmark(Benchmark): | |||
""" | |||
Concrete implementation of Benchmark for ledger test apply benchmark. |
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.
Could you fix the name, then?
let%bind lines = Reader.file_lines log_file in | ||
let perf_metrics = | ||
List.filter_map lines ~f:(fun line -> | ||
if String.is_substring line ~substring:" took " then |
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 is so fragile.
We have structured log, and parser specifically for structure logs, right?
Why can't we reuse that?
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.
Approved too fast, I think it worth to factor out the manual log parsing part and use structured log parsing utilities we already have in our codebase.
(* Convert performance metrics to a JSON format suitable for output *) | ||
(* The metrics are expected to be a list of tuples (operation, avg_time) *) | ||
(* where operation is a string and avg_time is a float representing the average time in milliseconds *) | ||
let perf_metrics_to_yojson metrics = |
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.
here
!ci-build-me |
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.
Please consider remove the use of regex as I suggested
(* Extract the operation and time from the line *) | ||
(* Parse the JSON line to extract the message field *) | ||
let pattern = | ||
Re.Perl.compile_pat {|(.+) took (\d+(?:\.\d+)?)(ms|us)|} |
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 using regex is an anti-pattern when we could have store the log information in a structural way.
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'd consider replace these loggings to structural alternative
$ rg ' took '
lib/diff.ml
97: "Archive data generation for $state_hash: accounts-accessed took $time ms"
129: "Archive data generation for $state_hash: accounts-created took $time ms"
lib/metrics.ml
10: "%s took %s" label
e.g.
in metrics.ml
:
let time ~label f =
let start = Time.now () in
let%map x = f () in
let stop = Time.now () in
[%log' info (Logger.create ())]
"%s took %s" label
(Time.Span.to_string_hum (Time.diff stop start)) ;
x
would be replaced by
let time ~label f =
let start = Time.now () in
let%map x = f () in
let stop = Time.now () in
let elapsed = Time.diff stop start in
[%log' info (Logger.create ())]
"%s took %s" label
(Time.Span.to_string_hum elapsed)
~metadata:
[ ("IS_ARCHIVE_PERF_METRICS", `Bool true)
; ("label", `String label)
; ("elapsed", `Float (Time.Span.to_ms elapsed))
] ;
x
Which is much easier to parse with yojson alone without regex.
!ci-build-me |
c67d4ff
to
c76daee
Compare
c069f60
to
00108a1
Compare
!ci-build-me |
buildkite/src/gen/Jobs.dhall
Outdated
-- This file is autogenerated during builds. It remains checked in to ensure | ||
-- dhall configuration can still execute locally without running codegen. | ||
let Pipeline = ../Pipeline/Dsl.dhall in [] : List Pipeline.CompoundType | ||
[ -- Autogenerated do not edit by hand , |
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.
Are these still in the scope of this PR? I thought it's only for a test for archive nodes.
But anyway, I think it'll be infra engs reviewing this part.
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.
Minor change requested, but LGTM overall
(* Extract performance metrics from the log file *) | ||
(* where X is a floating point number representing the time taken for the operation *) | ||
(* log output should be in JSON format *) | ||
(* Example log line: {..., "message": "Operation took 123.45 ms"} *) |
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 comment is outdated.
[ ("state_hash", Mina_base.State_hash.to_yojson state_hash) | ||
; ( "time" | ||
, `Float (Time.Span.to_ms (Time.diff accounts_accessed_time 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.
I assume this perf info is not important?
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 not needed as we are taking avg from all measurements.
|> Option.value_exn | ||
~message: | ||
("Missing elapsed in log entry in log line: " ^ line) | ||
|> Yojson.Safe.to_string |> Float.of_string |
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's better to use Yojson.Safe.Util.to_float
to avoid an additional level of converison.
This reverts commit 00108a1.
!ci-build-me |
!ci-build-me |
1 similar comment
!ci-build-me |
c7a7abd
to
b0abfc5
Compare
!ci-build-me |
Enhanced precomputed_blocks test with performance metrics gathering. Addec CI job which also upload it to influx db and once we fill out 10 historical values every measurement will be checked for regression. Example test output: