gvisor/benchmarks
dependabot[bot] 0eafb7eb27 Bump puma from 3.12.0 to 3.12.2 in /benchmarks/workloads/ruby_template
Bumps [puma](https://github.com/puma/puma) from 3.12.0 to 3.12.2.
<details>
<summary>Release notes</summary>

*Sourced from [puma's releases](https://github.com/puma/puma/releases).*

> v3.12.1
</details>
<details>
<summary>Changelog</summary>

*Sourced from [puma's changelog](https://github.com/puma/puma/blob/master/History.md).*

> ## 4.3.1 and 3.12.2 / 2019-12-05
>
> * Security
>   * Fix: a poorly-behaved client could use keepalive requests to monopolize Puma's reactor and create a denial of service attack. CVE-2019-16770.
>
> ## 4.3.0 / 2019-11-07
>
> * Features
>   * Strip whitespace at end of HTTP headers ([#2010](https://github-redirect.dependabot.com/puma/puma/issues/2010))
>   * Optimize HTTP parser for JRuby ([#2012](https://github-redirect.dependabot.com/puma/puma/issues/2012))
>   * Add SSL support for the control app and cli ([#2046](https://github-redirect.dependabot.com/puma/puma/issues/2046), [#2052](https://github-redirect.dependabot.com/puma/puma/issues/2052))
>
> * Bugfixes
>   * Fix Errno::EINVAL when SSL is enabled and browser rejects cert ([#1564](https://github-redirect.dependabot.com/puma/puma/issues/1564))
>   * Fix pumactl defaulting puma to development if an environment was not specified ([#2035](https://github-redirect.dependabot.com/puma/puma/issues/2035))
>   * Fix closing file stream when reading pid from pidfile ([#2048](https://github-redirect.dependabot.com/puma/puma/issues/2048))
>   * Fix a typo in configuration option `--extra_runtime_dependencies` ([#2050](https://github-redirect.dependabot.com/puma/puma/issues/2050))
>
> ## 4.2.1 / 2019-10-07
>
> * 3 bugfixes
>   * Fix socket activation of systemd (pre-existing) unix binder files ([#1842](https://github-redirect.dependabot.com/puma/puma/issues/1842), [#1988](https://github-redirect.dependabot.com/puma/puma/issues/1988))
>   * Deal with multiple calls to bind correctly ([#1986](https://github-redirect.dependabot.com/puma/puma/issues/1986), [#1994](https://github-redirect.dependabot.com/puma/puma/issues/1994), [#2006](https://github-redirect.dependabot.com/puma/puma/issues/2006))
>   * Accepts symbols for `verify_mode` ([#1222](https://github-redirect.dependabot.com/puma/puma/issues/1222))
>
> ## 4.2.0 / 2019-09-23
>
> * 6 features
>   * Pumactl has a new -e environment option and reads `config/puma/<environment>.rb` config files ([#1885](https://github-redirect.dependabot.com/puma/puma/issues/1885))
>   * Semicolons are now allowed in URL paths (MRI only), useful for Angular or Redmine ([#1934](https://github-redirect.dependabot.com/puma/puma/issues/1934))
>   * Allow extra dependencies to be defined when using prune_bundler ([#1105](https://github-redirect.dependabot.com/puma/puma/issues/1105))
>   * Puma now reports the correct port when binding to port 0, also reports other listeners when binding to localhost ([#1786](https://github-redirect.dependabot.com/puma/puma/issues/1786))
>   * Sending SIGINFO to any Puma worker now prints currently active threads and their backtraces ([#1320](https://github-redirect.dependabot.com/puma/puma/issues/1320))
>   * Puma threads all now have their name set on Ruby 2.3+ ([#1968](https://github-redirect.dependabot.com/puma/puma/issues/1968))
> * 4 bugfixes
>   * Fix some misbehavior with phased restart and externally SIGTERMed workers ([#1908](https://github-redirect.dependabot.com/puma/puma/issues/1908), [#1952](https://github-redirect.dependabot.com/puma/puma/issues/1952))
>   * Fix socket closing on error ([#1941](https://github-redirect.dependabot.com/puma/puma/issues/1941))
>   * Removed unnecessary SIGINT trap for JRuby that caused some race conditions ([#1961](https://github-redirect.dependabot.com/puma/puma/issues/1961))
>   * Fix socket files being left around after process stopped ([#1970](https://github-redirect.dependabot.com/puma/puma/issues/1970))
> * Absolutely thousands of lines of test improvements and fixes thanks to [@&#8203;MSP-Greg](https://github.com/MSP-Greg)
>
> ## 4.1.1 / 2019-09-05
>
> * 3 bugfixes
>   * Revert our attempt to not dup STDOUT/STDERR ([#1946](https://github-redirect.dependabot.com/puma/puma/issues/1946))
>   * Fix socket close on error ([#1941](https://github-redirect.dependabot.com/puma/puma/issues/1941))
>   * Fix workers not shutting down correctly ([#1908](https://github-redirect.dependabot.com/puma/puma/issues/1908))
>
> ## 4.1.0 / 2019-08-08
>
></tr></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>

- [`bb29fc7`](bb29fc7fe8) 3.12.2
- [`058df12`](058df12b78) 4.3.1 and 4.2.1 release notes
- [`06053e6`](06053e6090) Merge pull request from GHSA-7xx3-m584-x994
- [`461c9e9`](461c9e9978) Docs files
- [`7e2c88d`](7e2c88d413) v3.12.1
- [`36964ec`](36964ec429) Merge pull request [#1700](https://github-redirect.dependabot.com/puma/puma/issues/1700) from schneems/schneems/fix-puma-rack-handler-config
- [`c24c0c8`](c24c0c8834) Rack handler should use provided default host
- [`e5d566e`](e5d566ed81) Merge pull request [#1682](https://github-redirect.dependabot.com/puma/puma/issues/1682) from MSP-Greg/update-travis-ruby
- [`cecc44a`](cecc44aa0a) Merge pull request [#1701](https://github-redirect.dependabot.com/puma/puma/issues/1701) from schneems/schneems/m
- [`ce57cfb`](ce57cfb8c3) Allow running individual tests via the `m` gem.
- Additional commits viewable in [compare view](https://github.com/puma/puma/compare/v3.12.0...v3.12.2)
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=puma&package-manager=bundler&previous-version=3.12.0&new-version=3.12.2)](https://help.github.com/articles/configuring-automated-security-fixes)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/google/gvisor/network/alerts).

</details>

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/1345 from google:dependabot/bundler/benchmarks/workloads/ruby_template/puma-3.12.2 2be8d923b4cf5452e763ce369803f2729876b209
PiperOrigin-RevId: 297664218
2020-02-27 12:51:25 -08:00
..
examples Import benchmark-tools to main repository. 2019-12-02 22:53:26 -08:00
harness Fix master installer. 2020-02-21 13:18:51 -08:00
runner
suites Update commandline and get local runs working. 2020-01-15 14:26:15 -08:00
tcp Make gonet consistent both internally and with the net package. 2020-02-06 14:07:04 -08:00
workloads
BUILD Add flag to run without building baked images. 2020-02-17 15:02:20 -08:00
README.md
defs.bzl
requirements.txt
run.py

README.md

Benchmark tools

These scripts are tools for collecting performance data for Docker-based tests.

Setup

The scripts assume the following:

  • There are two sets of machines: one where the scripts will be run (controller) and one or more machines on which docker containers will be run (environment).
  • The controller machine must have bazel installed along with this source code. You should be able to run a command like bazel run :benchmarks -- --list
  • Environment machines must have docker and the required runtimes installed. More specifically, you should be able to run a command like: docker run --runtime=$RUNTIME your/image.
  • The controller has ssh private key which can be used to login to environment machines and run docker commands without using sudo. This is not required if running locally via the run-local command.
  • The docker daemon on each of your environment machines is listening on unix:///var/run/docker.sock (docker's default).

For configuring the environment manually, consult the dockerd documentation.

Running benchmarks

Locally

The tool is built to, by default, use Google Cloud Platform to run benchmarks, but it does support GCP workflows. To run locally, run the following from the benchmarks directory:

bazel run --define gcloud=off :benchmarks -- run-local startup

...
method,metric,result
startup.empty,startup_time_ms,652.5772
startup.node,startup_time_ms,1654.4042000000002
startup.ruby,startup_time_ms,1429.835

The above command ran the startup benchmark locally, which consists of three benchmarks (empty, node, and ruby). Benchmark tools ran it on the default runtime, runc. Running on another installed runtime, like say runsc, is as simple as:

bazel run  --define gcloud=off :benchmarks -- run-local startup --runtime=runsc

There is help: bash bazel run --define gcloud=off :benchmarks -- --help bazel run --define gcloud=off :benchmarks -- run-local --help

To list available benchmarks, use the list commmand:

bazel --define gcloud=off  run :benchmarks -- list

...
Benchmark: sysbench.cpu
Metrics: events_per_second
    Run sysbench CPU test. Additional arguments can be provided for sysbench.

    :param max_prime: The maximum prime number to search.

You can choose benchmarks by name or regex like:

bazel run --define gcloud=off :benchmarks -- run-local startup.node
...
metric,result
startup_time_ms,1671.7178000000001

or

bazel run --define gcloud=off :benchmarks -- run-local s
...
method,metric,result
startup.empty,startup_time_ms,1792.8292
startup.node,startup_time_ms,3113.5274
startup.ruby,startup_time_ms,3025.2424
sysbench.cpu,cpu_events_per_second,12661.47
sysbench.memory,memory_ops_per_second,7228268.44
sysbench.mutex,mutex_time,17.4835
sysbench.mutex,mutex_latency,3496.7
sysbench.mutex,mutex_deviation,0.04
syscall.syscall,syscall_time_ns,2065.0

You can run parameterized benchmarks, for example to run with different runtimes:

bazel run --define gcloud=off :benchmarks -- run-local --runtime=runc --runtime=runsc sysbench.cpu

Or with different parameters:

bazel run --define gcloud=off :benchmarks -- run-local --max_prime=10 --max_prime=100 sysbench.cpu

On Google Compute Engine (GCE)

Benchmarks may be run on GCE in an automated way. The default project configured for gcloud will be used.

An additional parameter installers may be provided to ensure that the latest runtime is installed from the workspace. See the files in tools/installers for supported install targets.

bazel run :benchmarks -- run-gcp --installers=head --runtime=runsc sysbench.cpu

When running on GCE, the scripts generate a per run SSH key, which is added to your project. The key is set to expire in GCE after 60 minutes and is stored in a temporary directory on the local machine running the scripts.

Writing benchmarks

To write new benchmarks, you should familiarize yourself with the structure of the repository. There are three key components.

Harness

The harness makes use of the docker py SDK. It is advisable that you familiarize yourself with that API when making changes, specifically:

  • clients
  • containers
  • images

In general, benchmarks need only interact with the Machine objects provided to the benchmark function, which are the machines defined in the environment. These objects allow the benchmark to define the relationships between different containers, and parse the output.

Workloads

The harness requires workloads to run. These are all available in the workloads directory.

In general, a workload consists of a Dockerfile to build it (while these are not hermetic, in general they should be as fixed and isolated as possible), some parsers for output if required, parser tests and sample data. Provided the test is named after the workload package and contains a function named sample, this variable will be used to automatically mock workload output when the --mock flag is provided to the main tool.

Writing benchmarks

Benchmarks define the tests themselves. All benchmarks have the following function signature:

def my_func(output) -> float:
    return float(output)

@benchmark(metrics = my_func, machines = 1)
def my_benchmark(machine: machine.Machine, arg: str):
    return "3.4432"

Each benchmark takes a variable amount of position arguments as harness.Machine objects and some set of keyword arguments. It is recommended that you accept arbitrary keyword arguments and pass them through when constructing the container under test.

To write a new benchmark, open a module in the suites directory and use the above signature. You should add a descriptive doc string to describe what your benchmark is and any test centric arguments.