Skip to content

Setup crank for performance tests - #2091

Merged
habbes merged 10 commits into
OData:masterfrom
habbes:perf/2089-setup-crank
May 20, 2021
Merged

habbes merged 10 commits into
OData:masterfrom
habbes:perf/2089-setup-crank

Conversation

@habbes

@habbes habbes commented May 17, 2021 •

Copy link
Copy Markdown
Contributor

Issues

Fixes #2089

Description

Adds Microsoft.Crank configuration and instructions for running benchmark tests.

Instructions on how to setup crank and run the benchmarks have been added to the README.

This PR has a lot file changes, but most of the changes are accidental fixes to the whitespace formatting, the main file changes are:

  • benchmarks.yml: this contains the crank configuration. It tells crank how to build our benchmark projects and which scenarios to run. I tried to make it easy to run different scenarios (component tests, e2e tests, running against the main repo, etc.) and added instructions to the README.md
  • README.md: added instructions on how to setup and run the benchmarks
  • OData.Test.Performance.sln, Microsoft.OData.Performance.ComponentTests.csproj, Microsoft.OData.Performance.ServiceTests.csproj: The crank-agent was getting a hard time trying to build the projects, it was not able to properly parse the .csproj config. To fix this I re-created the solution and projects, now they have simpler configuration and only support .Net Core 3.1 (It should be possible to add support for net47 I believe). The IDE formatted the whitespace in the source files during this process, that's why there are many changed files. In the process I also removed obsolete app.config, packages.config and AssemblyInfo.cs files.
  • TestServiceFixture.cs: this class is used by the "e2e" service tests to launch the test web service. It was using an env variable to locate the path of the test service. This was not easy to pass correctly to the crank config, so I updated the code so that it can manually find the directory to the test service.
  • PerformanceBuild.ps1: this is the old powershell script for building and running the performance benchmarks. I updated it to work with the changed project files. You can use it to run perf tests without having to setup crank.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

@marabooy marabooy changed the title Setup crank for perfmance tests Setup crank for performance tests May 17, 2021
@habbes habbes added the Ready for review Use this label if a pull request is ready to be reviewed label May 20, 2021
Comment thread README.md
the `base=true` variable to the command, e.g.:

```text
crank --config benchmarks.yml --scenario Service --profile local --variable base=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be local?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see if base=true then it will use the remote. To avoid confusion maybe call this out explicitly.

@habbes habbes May 20, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's local in the sense it runs locally on your machine. In the next PRs I intend to setup remote agents so you can run benchmarks on remote servers. But you will still have the option to either run your local copy of the code or the official repo. So base is probably not a good name, but local would be confusing. base=true means the official repo will be cloned to your agent (whether the agent is running locally or remotely), so any changes you've made locally won't be picked. It's meant to allow you to compare how changes affect the benchmarks compared to the official repo. Without base=true, your local project directory will be uploaded to the agent (whether the agent runs locally or remotely).

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread benchmarks.yml Outdated
Comment thread benchmarks.yml Outdated
Comment thread test/PerformanceTests/ServiceTests/AssemblyInfo.cs
Comment thread test/PerformanceTests/ServiceTests/UpdateTests.cs Outdated

@gathogojr gathogojr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a few minor comments otherwise looks great. I'll try it out locally

@pull-request-quantifier-deprecated

Copy link
Copy Markdown

This PR has 1117 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Large
Size       : +196 -921
Percentile : 100%

Total files changed: 21

Change summary by file extension:
.ps1 : +8 -13
.md : +58 -0
.yml : +76 -0
.sln : +0 -0
.csdl : +10 -10
.csproj : +25 -681
.cs : +19 -11
.config : +0 -206

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detetcted.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@habbes
habbes merged commit c41abd9 into OData:master May 20, 2021
@habbes
habbes deleted the perf/2089-setup-crank branch May 20, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Extra Large Ready for review Use this label if a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure crank to run performance tests

3 participants