|
| 1 | +--- |
| 2 | +RFC: |
| 3 | +Author: Aditya Patwardhan |
| 4 | +Status: Draft |
| 5 | +SupercededBy: |
| 6 | +Version: 0.1 |
| 7 | +Area: Testing |
| 8 | +Comments Due: 10/15/2017 |
| 9 | +Plan to implement: Yes |
| 10 | +--- |
| 11 | + |
| 12 | +# Performance testing for PowerShell |
| 13 | + |
| 14 | +This RFC proposes the plan to add AppInsights instrumentation to collect performance telemetry from daily CI runs. This RFC specifies the additional telemetry that will be added. |
| 15 | + |
| 16 | +## Motivation |
| 17 | + |
| 18 | +To validate the performance of PowerShell, we need to gather performance measurements at regular intervals. |
| 19 | +This will enable us in visualizing performance trends and help us identify performance regressions. |
| 20 | + |
| 21 | +## Specification |
| 22 | + |
| 23 | +This RFC proposes to add AppInsights telemetry data points to gather performance metrics. |
| 24 | +These metrics will be collected only during daily CI runs in AppVeyor and Travis CI. |
| 25 | +Typically, we would need large number of iterations to get stable numbers. |
| 26 | +A [metric aggregator](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackmetric) will be used to compose the data from iterations and then upload the telemetry data points. |
| 27 | +This will avoid throttling and dropping of events. |
| 28 | + |
| 29 | +### Proposed performance test scenarios |
| 30 | + |
| 31 | +* PowerShell startup time for cold and warm start. |
| 32 | + |
| 33 | +* `Get-Command` for a particular module. |
| 34 | + |
| 35 | +* `Get-Help` for non-existent command, about topic and cmdlet. |
| 36 | + |
| 37 | +* `Import-Module` for script-based, binary modules. |
| 38 | + |
| 39 | +* `Get-Module -ListAvailable` of a scoped PSModulePath constrained to test modules. |
| 40 | + |
| 41 | +* Parsing of scripts, classes. |
| 42 | + |
| 43 | +Telemetry events will be added to PowerShell code at appropriate locations to collect these metrics. |
| 44 | +Before recording data points, it will be verified that we are running a daily run in AppVeyor or Travis CI. |
| 45 | +PowerBI dashboard will be created to visualize the metrics. |
| 46 | + |
| 47 | +### Environment |
| 48 | + |
| 49 | +* PowerShell assemblies are CrossGen'ed. |
| 50 | +* PSModulePath will be scoped to performance test modules path. |
| 51 | +* Windows, Linux and MacOS have separate AppInsights streams, so they can be tracked separately. |
| 52 | +* All measurements will be for test artifacts to reduce variance due to product module changes. |
| 53 | + |
| 54 | +## Alternate Proposals and Considerations |
| 55 | + |
| 56 | +AppInsights was chosen to achieve cross platform compatibility. |
| 57 | +Another alternative would be to develop a framework to log metric as cross platform module. |
| 58 | +It would be lot of work to create a precise and reliable framework. |
| 59 | + |
| 60 | +Defining goals for these metrics is out of scope for this RFC. |
| 61 | + |
| 62 | +DotNet / CoreFX uses [xUnit performance framework](https://github.com/Microsoft/xunit-performance). |
| 63 | +It requires us the develop the tests in C# and hence we would have to use Powershell APIs to execute tests. |
| 64 | +The lowest granularity for measurement we get would be around `PowerShell.AddScript().Invoke()`. |
| 65 | +This would be too broad of a measurement and might hide the scenario under test. |
0 commit comments