DuendeSoftware / IdentityServer

The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
https://duendesoftware.com/products/identityserver
Other
1.45k stars 337 forks source link

Rewrite LicenseValidator.ValidateClient to not use ConcurrentDictionary #1526

Closed AndersAbel closed 6 months ago

AndersAbel commented 6 months ago

The ConcurrentDictionary type is optimized for concurrent key/value reads/write. The Count and Keys properties has inefficient locking mechanisms. Performing multiple operations on a ConcurrentDictionary also adds a performance penalty as each operation acquires and releases the locks. It would be much more efficient to acquire the locks required, then perform all the operations and then release.

This has been reported in https://github.com/DuendeSoftware/Support/issues/1161.

AndersAbel commented 6 months ago

Fixed by #1527