Open sebastienros opened 4 years ago
@sebastienros what's the best way for me to started on this issue, I'm assuming add some baseline scenario tests to get initial numbers and profiles?
Adding table for tracking some initial numbers (using existing mvc product crud APIs):
Scenario | request/second | % |
---|---|---|
Jwt bombadier Baseline (Auth/JwtAuth = false) | 97,840 | 0% |
UseAuthN/AuthZ (no app usage) | 93,830 | -4% |
UseAuthN/AuthZ (with allow anon) | 88,658 | -9.5% |
UseAuthN/AuthZ (send jwt + default scheme + no valid audience/issuer) | 41,133 | -58% |
UseAuthN/AuthZ (send jwt + default scheme + valid audience/issuer) | 48,447 | -50.5% |
UseAuthN/AuthZ (custom jwtwebtoken handler send jwt + default scheme + valid audience/issuer) | 66,035 | -32.5% |
UseAuthN/AuthZ (with 6.8.0 handler send jwt + default scheme + valid audience/issuer) | 54,189 | -44.6% |
Cert http client Baseline(Auth/CertAuth = false) | 71,668 | 0% |
UseAuthN/AuthZ (with expired cert, https, ssl required, cert cache miss, cert forwarding) | 13,085 | -81.7% |
UseAuthN/AuthZ (with expired cert, https, ssl required, cert cache miss, no cert forwarding) | 13,337 | -81.4% |
UseAuthN/AuthZ (with expired cert, https, ssl required, cert cache hit with removed expiry check, no cert forwarding) | 58,960 | -17.8% |
Just sending an authorization bearer header with jwtbearer authentication as the default scheme results in a drop to 41,133 requests/second so a -58% hit
Status: @HaoK has started looking at traces
Next steps following sync up:
Jwt
Cert
Cookies
Also remove MVC from the scenarios to reduce clutter
@brentschmaltz @jmprieur just giving you guys a heads up that I'm going to be playing a bit around and looking at micro benchmarking JwtSecurityToken.ValidateToken since it seems to be a hot path in our current perf benchmarks. If you've done any work in this area already, or if there's any preferred way you'd like us to collaborate on perf improvements here, please let us know
Starting profile using VS of ValidateToken of our current jwt token in a loop 100x
And starting BenchmarkDotNumber numbers for ValidateToken
Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|
Validate | 25.54 us | 34.87 us | 1.912 us | 4.5776 | - | - | 18.73 KB |
Updates:
Is there any chance of using AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#1365 ? I remember seeing claims of massive speed improvements from moving to the new class.
Updated perf view removing MVC with the new 6.8 packages:
JWT
Cert perf with no mvc and a valid cert and validation cache hit, basically don't see cert auth at all in the profile now
Improve performance characteristics of authentication middleware.
Areas of interest: