Skip to content
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 cli #5652

Merged
merged 3 commits into from
Feb 28, 2023
Merged

Benchmark cli #5652

merged 3 commits into from
Feb 28, 2023

Conversation

butonic
Copy link
Member

@butonic butonic commented Feb 24, 2023

For stress testing and analysis we added a two cli benchmark commands to gather different statistics or to put a system under load. use the cli help

$ ocis/bin/ocis benchmark syscalls help
NAME:
   ocis benchmark syscalls - test how fast syscalls are

USAGE:
   ocis benchmark syscalls [command options] [arguments...]

CATEGORY:
   benchmark

OPTIONS:
   --path value        Path to test
   --iterations value  Number of iterations to execute (default: "100")
   --help, -h          show help

$ ocis/bin/ocis benchmark client help
NAME:
   ocis benchmark client - Start a client that continuously makes web requests and prints stats. The options mimic curl, but URL must be at the end.

USAGE:
   ocis benchmark client [command options] [arguments...]

CATEGORY:
   benchmark

OPTIONS:
   --request value, -X value                              Specifies a custom request method to use when communicating with the HTTP server. (default: "PROPFIND")
   --user value, -u value                                 Specify the user name and password to use for server authentication. (default: "admin:admin")
   --insecure, -k                                         Skip the TLS verification step and proceed without checking. (default: false)
   --data value, -d value                                 Sends the specified data in a request to the HTTP server.
   --header value, -H value [ --header value, -H value ]  Extra header to include in information sent.
   --bearer-token-command value                           Command to execute for a bearer token, e.g. 'oidc-token OCIS'. When set, disables basic auth.
   --every value                                          Aggregate stats every time this amount of seconds has passed. (default: 0)
   --jobs value, -j value                                 Number of parallel clients to start. (default: 1)
   --help, -h                                             show help

Examples

PROPFIND the demo instance with the default admin account

$ ocis/bin/ocis benchmark client https://cloud.ocis.test/remote.php/webdav
req 1 took 1.413333631s and returned status 207
req 2 took 252.108027ms and returned status 207
req 3 took 265.227102ms and returned status 207
req 4 took 249.377407ms and returned status 207
...

upload file

$ ocis/bin/ocis benchmark client --request PUT --data "foo" https://cloud.ocis.test/remote.php/webdav
/foo.txt
req 1 took 173.764124ms and returned status 201
req 2 took 166.867289ms and returned status 204
req 3 took 172.991281ms and returned status 204
req 4 took 166.175506ms and returned status 204
...

trust self signed certificates, start 36 concurrent clients, aggregate stats every 3 sec

$ ocis/bin/ocis benchmark client --bearer-token-command "oidc-token admin-ocis-owncloud-test" -k -j 36 --every 3 https://cloud.ocis.test/remote.php/webdav/foo.txt 
364 req at 268.969301ms/req
538 req at 190.677261ms/req
548 req at 195.940286ms/req
282 req at 330.920992ms/req
486 req at 246.011642ms/req
...

TODO

  • allow {templates} in data und url parameters ... can use the client number, request number, a random string, or a callback?
  • add throttle?

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

add benchmark client & syscall commands

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@update-docs
Copy link

update-docs bot commented Feb 24, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@butonic butonic self-assigned this Feb 24, 2023
@butonic butonic added the Category:Enhancement Add new functionality label Feb 24, 2023
@butonic butonic marked this pull request as ready for review February 24, 2023 23:57
@mmattel
Copy link
Contributor

mmattel commented Feb 27, 2023

Shall we add this in the admin documentation? I mean, it is already visible here and on the command line help, so it can be found. But we could proactively help admins when it comes to benchmark their environment (and compare it to others).

Co-authored-by: Martin <github@diemattels.at>
@ownclouders
Copy link
Contributor

💥 Acceptance test Core-API-Tests-ocis-storage-5 failed. Further test are cancelled...

@sonarcloud
Copy link

sonarcloud bot commented Feb 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@butonic butonic merged commit ddae4f6 into master Feb 28, 2023
@delete-merged-branch delete-merged-branch bot deleted the benchmark-cli branch February 28, 2023 08:14
ownclouders pushed a commit that referenced this pull request Feb 28, 2023
Author: Jörn Friedrich Dreyer <jfd@owncloud.com>
Date:   Tue Feb 28 09:14:53 2023 +0100

    Benchmark cli (#5652)

    * cli to benchmark low level syscalls

    Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

    add benchmark client & syscall commands

    Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

    * update the oidc-agent docs

    Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

    * Update ocis/pkg/command/benchmark.go

    Co-authored-by: Martin <github@diemattels.at>

    ---------

    Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
    Co-authored-by: Martin <github@diemattels.at>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Enhancement Add new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants