You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,16 +40,38 @@ If the connection is successful, we can use this connection for execution of RAR
40
40
41
41
This step will create new process which will act as RAR node. It will also pass necessary information to the node to know what its settings are (reusable, ...). Node will be another instance of the MSBuild.exe which will have set parameter **nodeMode** to some specific value (it should be `/nodeMode:3`).
42
42
43
-
We will use Mutex (as in [Roslyn](https://github.com/dotnet/roslyn/blob/838874b1b817db84ce146bef690cc95a39c213a5/src/Compilers/Server/VBCSCompiler/BuildServerController.cs#L143)) to ensure we don't create two RAR nodes at once. Its name must encode whether it is the user's only RAR node, including user name, administrator privileges, and some initial settings for the node. Such a name could be: `MSBuild.RAR.ostorc.7`, where **MSBuild.RAR** is its prefix, **ostorc** is the user who called MSBuild, and **7** represents encoded settings (flag enum).
43
+
We will use named-pipe exclusivity to ensure we don't create multiple RAR nodes at once. Its name must encode whether it is the user's only RAR node, including user name, administrator privileges, and some initial settings for the node. Such a name could be: `MSBuild.RAR.ostorc.7`, where **MSBuild.RAR** is its prefix, **ostorc** is the user who called MSBuild, and **7** represents encoded settings (flag enum).
44
+
45
+
RAR Node will adopt existing MSBuild infrastructure code, NodeProviderOutOfProcTaskHost and related, used for invoking tasks out of process.
46
+
47
+
This code already solved many aspect of 'Out of process task invocation':
48
+
- serialization of task inputs and outputs
49
+
- distributed logging
50
+
- environmental variables
51
+
- current directory path
52
+
- current culture
53
+
- cancellation
54
+
- etc...
44
55
45
56
### Execute RAR task
46
57
47
58
Execution should be the same as it is now.
48
59
49
60
There is already some layer of separation between Task interface and actual execution method. We will leverage this, and put the decision logic if to run locally or not into the "wrapper" method and so we will not have to modify this and in server-side execution we will directly call the internal execution method.
50
61
62
+
#### RAR Concurrency
63
+
51
64
There is one big concern and that is how to handle multiple requests at once. As right now, RAR task is not prepared for multi-thread use.
52
65
66
+
One of the biggest challenges with RAR as service, is to make execution and caching of RAR task thread-safe, since in most cases there will be multiple clients requesting data from it at once.
67
+
68
+
So far, we have identified following areas that have to be addressed to allow concurrent execution of RAR tasks:
69
+
70
+
- thread safety (static variables, shared data structures, caching, ...)
71
+
- environmental variables virtualization
72
+
- current directory virtualization
73
+
- current culture isolation
74
+
53
75
### Shutdown RAR node
54
76
55
77
If the user does not want the node to be reused, we have the ensure that node will be killed after the build ends. This should be done after the main MSBuild node finishes building.
@@ -70,145 +92,18 @@ __NOTE:__ The behavior described above depend on fact that the feature is opt-ou
70
92
71
93
## Communication
72
94
73
-
The communication between nodes should be done over [StreamJsonRpc](https://github.com/microsoft/vs-streamjsonrpc/). The API over which two node will transfer data has to reflect inputs and outputs of RAR task as described in [docs](https://docs.microsoft.com/visualstudio/msbuild/resolveassemblyreference-task?view=vs-2019).
74
-
75
-
Note that, the following snippets are probably not final version of the API and are here to give rough idea, what must be transferred.
publicMicrosoft.Build.Framework.ITaskItem[] CopyLocalFiles { get { thrownull; } }
176
-
177
-
publicstringDependsOnNETStandard { get { thrownull; } }
178
-
179
-
publicstringDependsOnSystemRuntime { get { thrownull; } }
180
-
181
-
publicMicrosoft.Build.Framework.ITaskItem[] FilesWritten { get { thrownull; } }
182
-
183
-
publicMicrosoft.Build.Framework.ITaskItem[] RelatedFiles { get { thrownull; } }
184
-
185
-
publicMicrosoft.Build.Framework.ITaskItem[] ResolvedDependencyFiles { get { thrownull; } }
186
-
187
-
publicMicrosoft.Build.Framework.ITaskItem[] ResolvedFiles { get { thrownull; } }
188
-
189
-
publicMicrosoft.Build.Framework.ITaskItem[] SatelliteFiles { get { thrownull; } }
190
-
191
-
publicMicrosoft.Build.Framework.ITaskItem[] ScatterFiles { get { thrownull; } }
192
-
193
-
publicMicrosoft.Build.Framework.ITaskItem[] SerializationAssemblyFiles { get { thrownull; } }
194
-
195
-
publicMicrosoft.Build.Framework.ITaskItem[] SuggestedRedirects { get { thrownull; }
196
-
}
197
-
```
198
-
### Logging response
199
-
200
-
Node also has to return loggeddata, preferablyinstreamwhichwillbetransferredduringtheRARtaskexecutiontotheclientnode. ThisshouldbydonebyusingIProgress\<T> supportinStreamJsonRPC. Thereisalsosupportforasyncenumerable, buttheymustbepulledandarenotpushedtotheclient (comparisoncanbefound [here](https://github.com/microsoft/vs-streamjsonrpc/blob/master/doc/asyncenumerable.md#comparison-with-iprogresst)).
95
+
The communication between nodes should be same as current cross node communication. RAR service will allow multiple net-pipe clients, each client session handled in separate thread.
RAR will use same instrumentation infrastructure leveraged by standard MSBuild nodes. We will make sure we log all important events needed to measure, maintain and troubleshoot RAR service.
Instrumentation of RAR task execution will not change and will be handled by Out of process task infrastructure.
207
102
208
103
# Non-Goals
209
104
210
105
- File watchers: using them would decrease required IO operations when checking disc changes
211
-
- Aggressiveprecomputationofresults
106
+
- Aggressive pre-computation of results
212
107
- Improved caching of requests
213
108
- Providing verbosity to RAR task:
214
109
As mentioned in original [PR](https://github.com/dotnet/msbuild/pull/3914), there should be some way to determine what thing we should log (by severity), and pass back to the original node.
0 commit comments