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

Make SDK resolution a service #2847

Merged
merged 6 commits into from
Jan 8, 2018
Merged

Make SDK resolution a service #2847

merged 6 commits into from
Jan 8, 2018

Conversation

jeffkl
Copy link
Contributor

@jeffkl jeffkl commented Jan 8, 2018

A singleton instance handles all resolution. A service hosted in the main node handles build related evaluation on the main node and a service hosted in the out-of-proc node sends requests to the main node for processing.

A cache exists on the main node so that requests are only resolved once per build. The out-of-proc node also caches responses so that an SDK is only resolved once.

Non-build evaluations are not cached and could be slow since there is no way to know if two evaluations are related.

Address the first step in #2803

BuildEventContext.InvalidTaskId));
BuildEventContext.InvalidTaskId),
sdkResolverService,
_requestEntry.Request.SubmissionId);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indenting


/// <summary>
/// Resolves the specified SDK.
/// </summary>
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a remark here about locking? This does quite a bit of implicit thread synchronization where I would probably expect to see locks. A comment about that could help make it more obvious when locks are taken via the concurrent dictionaries.

private void HandleRequest(int node, SdkResolverRequest request)
{
// Start the background thread which will process queued requests if it has not already been started.
lock (_lockObject)
Copy link
Contributor

Choose a reason for hiding this comment

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

lock [](start = 12, length = 4)

Duplicate the if (_requestHandler == null) to avoid locking

@@ -12,6 +12,7 @@

namespace Microsoft.Build.Engine.UnitTests.BackEnd
{
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be adapted? Or delete the file if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My next commit has renamed and updated these tests

@AndyGerlicher
Copy link
Contributor

Evaluation: Time (ms)

Test Overall Significant δ Value
DotnetConsoleProject 👌 no 30.037 -> 30.1328 (0.319%)
DotnetWebProject 🔴 yes 52.8334 -> 53.6187 (1.486%)
DotnetMvcProject yes 60.8799 -> 60.3105 (-0.935%)
Picasso yes 257.1541 -> 252.2884 (-1.892%)
SmallP2POldCsproj 🔴 yes 43.2844 -> 43.6515 (0.848%)
SmallP2PNewCsproj yes 77.4671 -> 76.6266 (-1.085%)
Generated_100_100_v150 yes 1307.5339 -> 1302.9129 (-0.353%)
LargeP2POldCsproj 🔴 yes 762.9163 -> 772.2363 (1.222%)
OrchardCore yes 2191.7377 -> 2184.952 (-0.31%)
Roslyn 🔴 yes 3410.4552 -> 3416.4388 (0.175%)

Evaluation: Memory (bytes)

Test Overall Significant δ Value
DotnetConsoleProject ::ok_hand: no 5068094 -> 5067384 (-0.014%)
DotnetWebProject ::ok_hand: no 3941020 -> 3940040 (-0.025%)
DotnetMvcProject ::ok_hand: no 4719089 -> 4718060 (-0.022%)
SmallP2PNewCsproj ::ok_hand: no 10267390 -> 10267390 (0%)
Generated_100_100_v150 ::ok_hand: no 141238686 -> 141238291 (0%)
LargeP2POldCsproj ::ok_hand: no 82202011 -> 82202010 (0%)
OrchardCore 🔴 yes 241648067 -> 241651028 (0.001%)
Roslyn yes 297980190 -> 297926534 (-0.018%)

Build: Time (ms)

Test Overall Significant δ Value
DotnetConsoleProject yes 10.5055 -> 10.3566 (-1.417%)
DotnetWebProject ::ok_hand: no 12.0629 -> 12.046 (-0.14%)
DotnetMvcProject yes 12.8777 -> 12.6533 (-1.743%)
Picasso yes 1918.0343 -> 1898.2081 (-1.034%)
SmallP2POldCsproj ::ok_hand: no 80.9622 -> 80.7869 (-0.217%)
SmallP2PNewCsproj yes 79.0217 -> 76.0494 (-3.761%)
OrchardCore yes 12370.6734 -> 11870.4999 (-4.043%)

Build: Memory (bytes)

Test Overall Significant δ Value
DotnetConsoleProject 🔴 yes 1133000 -> 1133248 (0.022%)
DotnetWebProject 👌 no 1272371 -> 1272746 (0.029%)
DotnetMvcProject 👌 no 1444942 -> 1444973 (0.002%)
Picasso 👌 no 79674368 -> 79687704 (0.017%)
SmallP2POldCsproj 👌 no 7895373 -> 7897780 (0.03%)
SmallP2PNewCsproj yes 6790775 -> 6678617 (-1.652%)
OrchardCore 🔴 yes 442251032 -> 445467553 (0.727%)

…ImportsAreInPreprocessedOutput by using TestEnvironment to mock SDK resolution
Copy link
Contributor

@AndyGerlicher AndyGerlicher left a comment

Choose a reason for hiding this comment

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

Add the escape hatch for caching and looks good to me.

@jeffkl jeffkl merged commit 03d1435 into dotnet:master Jan 8, 2018
@jeffkl jeffkl deleted the sdk-resolution branch January 8, 2018 22:56
@jeffkl jeffkl mentioned this pull request Jan 9, 2018
7 tasks
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.

2 participants