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

Remove locks in SignatureProviders #1535

Merged
merged 3 commits into from
Oct 8, 2020
Merged

Remove locks in SignatureProviders #1535

merged 3 commits into from
Oct 8, 2020

Conversation

brentschmaltz
Copy link
Member

This PR adds an object pool that allows for the removal of locks when preforming crypto operations involving signatures. The 'objectpool' was copied from .net core as it is not available in 4.x.

@@ -0,0 +1,139 @@
//------------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

Should we rename this class to "DisposableObjectPool"?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 7, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 6 Code Smells

92.3% 92.3% Coverage
0.0% 0.0% Duplication

@brentschmaltz
Copy link
Member Author

brentschmaltz commented Oct 7, 2020

@GeoK @keegan-caruso i upadate the PR, removing the locks in RsaCryptoServiceProxy and adding a programming possibility (not particularly elegant) opportunity to set the pool size.

I struggled with naming and settled with DefaultSignatureProviderObjectPoolCacheSize, specifying using SignatureProvider in the name, rather than a more generic DefaultObjectPoolCacheSize, in case someone wanted to have different sizes (highly unlikely, however who knows).

@@ -41,6 +41,8 @@ public class CryptoProviderFactory
private static CryptoProviderFactory _default;
private static ConcurrentDictionary<string, string> _typeToAlgorithmMap = new ConcurrentDictionary<string, string>();
private static object _cacheLock = new object();
private static int _defaultSignatureProviderObjectPoolCacheSize = Environment.ProcessorCount * 4;
Copy link
Member

Choose a reason for hiding this comment

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

Just curios on why we decided to change the default object pool size?

Copy link
Contributor

@keegan-caruso keegan-caruso left a comment

Choose a reason for hiding this comment

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

LGTM, curious about @GeoK 's questions and stress / perf findings

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