Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

feat: add endAtRME option to end when rme drops below threshold #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

watson
Copy link

@watson watson commented Sep 9, 2019

This new config option allows to end the benchmark earlier than normal in case the relative margin of error drops below the specified amount, e.g. 1%.

Without this option, you'd have to set a high enough maxTime to ensure the benchmark ran long enough to get a low rme. With this option, the benchmark can exit as early as possible to save time.

Example

const bench = new Benchmark('foo', fn, {
  endAtPct: 1 // end benchmark when rme is below 1%
})

Use this config option to end the benchmark earlier than normal in case
the relative margin of error (rme) drops below the specified amount,
e.g. 1%.
@watson watson changed the title feat: add endAtPct option to exit early when rme is low feat: add endAtRME option to end when rme drops below threshold Sep 9, 2019
watson added a commit to elastic/apm-agent-nodejs that referenced this pull request Sep 13, 2019
This commit enables benchmarks for the Node.js agent. For every commit
to master, Jenkins will the benchmarks located in the `test/benchmarks`
directory.

Currently, those benchmarks are:

- `test/benchmarks/001-transaction-and-span-no-stack-trace.js`,
  Measures the overhead of starting and ending a transaction and a span
  without a stack trace

- `test/benchmarks/002-transaction-and-span-overhead-realistic-size.js`,
  Measures the overhead of starting and ending a transaction and a span
  with a realistic size stack trace

- `test/benchmarks/003-transaction-and-span-with-stack-trace.js`,
  Measures the overhead of starting and ending a transaction and a span
  with a simple uniform stack trace

- `test/benchmarks/004-transaction.js`,
  Measures the overhead of starting and ending a transaction only

- `test/benchmarks/005-transaction-reading-file.js`,
  Measures the overhead of starting and ending a transaction only while
  reading a file

The benchmarks are using the benchmark.js benchmarking tool. For each of
the benchmarks, it would be best to get the relative margin of error
down below 1%, but benchmark.js doesn't support running the benchmark
until a given relative margin of error threshold. So for now this commit
just run each of them for 2x60 seconds (60 seconds for the benchmark it
self and 60 seconds for the control), which in most cases gets them
below the magic 1%.

A PR has been opened to add this feature to benchmark.js:

bestiejs/benchmark.js#223

Each of the benchmarks a new document is added to our Elasticsearch
benchmarking cluster when running on Jenkins.

To add a new benchmark, simply add a new file to the `test/benchmarks`
directory.

To get more info about how to run the benchmarks locally, run:

    npm run bench -- --help

Closes #293 
Closes #306
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant