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

improve perf for default_signer: Don't create new PKey::RSA if we already can sign #591

Merged
merged 1 commit into from
Apr 21, 2023

Conversation

yosiat
Copy link
Contributor

@yosiat yosiat commented Apr 9, 2023

As of today we creating new OpenSSL::PKey::RSA when we sign, even if the existing signing_key is already a OpenSSL::PKey::RSA.

In google ruby gem they are doing the same approach - https://github.com/googleapis/google-cloud-ruby/blob/main/google-cloud-storage/lib/google/cloud/storage/file/signer_v2.rb#L137

Warming up --------------------------------------
                sign   119.000  i/100ms
                 new   179.000  i/100ms
Calculating -------------------------------------
                sign      1.199k (± 0.7%) i/s -      6.069k in   5.063095s
                 new      1.791k (± 0.6%) i/s -      9.129k in   5.096376s

Comparison:
                 new:     1791.3 i/s
                sign:     1198.7 i/s - 1.49x  slower

source: https://gist.github.com/yosiat/372bc468d23c568cd8722af7f56a2b03

As of today we creating new `OpenSSL::PKey::RSA` when we sign, even if the existing `signing_key` is already a `OpenSSL::PKey::RSA`.

In google ruby gem they are doing the same approach - https://github.com/googleapis/google-cloud-ruby/blob/main/google-cloud-storage/lib/google/cloud/storage/file/signer_v2.rb#L137

```
Warming up --------------------------------------
                sign   119.000  i/100ms
                 new   179.000  i/100ms
Calculating -------------------------------------
                sign      1.199k (± 0.7%) i/s -      6.069k in   5.063095s
                 new      1.791k (± 0.6%) i/s -      9.129k in   5.096376s

Comparison:
                 new:     1791.3 i/s
                sign:     1198.7 i/s - 1.49x  slower
```

source: https://gist.github.com/yosiat/372bc468d23c568cd8722af7f56a2b03
@korichdaniel
Copy link

@geemus Can you review this PR?
Thank you.

@geemus geemus merged commit 4d914bb into fog:master Apr 21, 2023
@geemus
Copy link
Member

geemus commented Apr 21, 2023

Thanks!

@geemus
Copy link
Member

geemus commented May 2, 2023

Released in v1.20.0.

@yosiat yosiat deleted the bit-faster-sign branch November 7, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants