Skip to content

Commit 456d359

Browse files
authored
Merge pull request #110 from Project-MONAI/dotnet_perf
Updated dotnet perf app
2 parents bf9bc34 + c8f4d13 commit 456d359

File tree

24 files changed

+168
-571
lines changed

24 files changed

+168
-571
lines changed

performance-testing/README.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Performance tests have been written to simulate real life load on the MONAI Depl
66
- MONAI Workflow Manager (WM) and its dependencies
77
- MONAI Informatics Gateway (IG) and its dependencies
88
- Docker
9-
- Orthanc
10-
- Dummy models (to be included as part of WM development)
9+
- Dummy models
1110
- ELK Stack
1211
- Prometheus and Grafana
1312
- Test data (CT, MR, US, RF)
@@ -23,10 +22,8 @@ Performance tests have been written to simulate real life load on the MONAI Depl
2322
- k6 Scripts
2423
- dicom_benchmark.js - Sends MR study store requests with a 2 minute sleep between each iteration.
2524
- dicom_peak_avg.js - Sends CT, MR, US and RF study store requests based on the configuration
26-
- Orthanc
27-
- is an open-source lightweight DICOM server.
28-
- Will perform C-STORE requests to MIG.
29-
- 2 modalities set up (MONAI, NOTMONAI) which will send C-STORE with an AET which will either trigger or workflow or wont depending on the Clinical Workflows set up.
25+
- dotnet-performance-app
26+
- A lightweight .net 6 app which is used for sending C-STORE requests using fo-dicom
3027
- ELK Stack
3128
- A log aggregator (i.e ELK) will be used for capturing all logs so that investigation of run time metrics can be achieved.
3229
- Grafana and Prometheus
@@ -40,7 +37,7 @@ Performance tests have been written to simulate real life load on the MONAI Depl
4037
| Medium | 8 | 10GB | 6GB | 15GB |
4138
| Large | 12 | 16GB | 12GB | 25GB |
4239

43-
### Clinical Workflow Example ##
40+
## Clinical Workflow Example #
4441
```
4542
AET: MONAI
4643
Tasks [
@@ -84,6 +81,26 @@ Tasks [
8481
}
8582
]
8683
```
84+
## Running dotnet-performance-app
85+
### Building the app
86+
87+
```bash
88+
cd performance-testing/dotnet-performance-app
89+
```
90+
91+
```bash
92+
dotnet build
93+
```
94+
95+
### Running as docker image
96+
```bash
97+
docker build -t dotnet-performance-app .
98+
```
99+
100+
```bash
101+
docker run -it --rm -p 5000:80 -p 5001:443 -e InformaticsGateway__Host={host} dotnet-performance-app
102+
```
103+
> **host** is to be replaced with the the host that MIG is running on
87104
88105
## Tests ##
89106
### Liver Seg Benchmark ###
@@ -92,17 +109,13 @@ Liver Seg Benchmark tests will be used to measuring the use of a MAP within MONA
92109
#### Set Up ####
93110
- Deploy MIG and MWM to an environment including all its dependencies.
94111
- Set up MIG with AET and Destinations scripts found [here](/k6/dicom/testdata/liver/postman_collection/)
95-
- Seed Orthanc with Test Data from [here](/k6/dicom/testdata/liver/benchmark_dicoms/)
96-
- Set up Orthanc with a Remote Modality, configuration can be found [here](https://book.orthanc-server.com/users/configuration.html#configuration)
97-
- MONAI - This will be send C-STORE requests to MIG with an AET "MONAI"
98112
- Seed MongoDB with Clinical Workflows found [here](/k6/dicom/testdata/liver/clinical_workflow/liver_seg.json)
99113
- Seed Argo with the Argo Workflow Templates found [here](/k6/dicom/testdata/liver/argo_template/liver-seg-argo-template.yaml)
100114
- Install k6 from [here](https://k6.io/docs/getting-started/installation/)
101-
- Update Orthanc details (i.e url) in the config/liverConfig.json
102115

103116
#### Running Tests ####
104117
```bash
105-
cd k6
118+
cd performance-testing/k6
106119
```
107120

108121
```bash
@@ -126,7 +139,7 @@ Liver Seg Benchmark parallel tests will be used to measuring the use of a MAP wi
126139

127140
#### Running Tests ####
128141
```bash
129-
cd k6
142+
cd performance-testing/k6
130143
```
131144

132145
```bash
@@ -143,23 +156,25 @@ Benchmark tests will be used to measuring the best performance of the MONAI stac
143156
#### Set Up ####
144157
- Deploy MIG and MWM to an environment including all its dependencies.
145158
- Set up MIG with AET and Destinations scripts found [here](TBD)
146-
- Seed Orthanc with Test Data from [here](TBD)
159+
- Run dotnet-performance-app
147160
- Set up Orthanc with a Remote Modality, configuration can be found [here](https://book.orthanc-server.com/users/configuration.html#configuration)
148161
- MONAI - This will be send C-STORE requests to MIG with an AET "MONAI"
149162
- Seed MongoDB with Clinical Workflows found [here](TBD)
150163
- Seed Argo with the Argo Workflow Templates found [here](TBD)
151164
- Install k6 from [here](https://k6.io/docs/getting-started/installation/)
152-
- Update Orthanc details (i.e url) in the config/benchmarkConfig.json
153165

154166
#### Running Tests ####
155167
```bash
156-
cd k6
168+
cd performance-testing/k6
157169
```
158170

159171
```bash
160-
k6 run -e CONFIG=config/benchmarkConfig.json -e ORTHANC_URL={url} -e ORTHANC_USER={user} -e ORTHANC_PASS={pass} -e DICOM_MODALITY={modality} dicom/dicom_benchmark.js --insecure-skip-tls-verify
172+
k6 run -e CONFIG=config/benchmarkConfig.json -e URL={url} -e DICOM_MODALITY={modality} dicom/dicom_benchmark.js --insecure-skip-tls-verify
161173
```
162174

175+
> **url** is to be replaced by dotnet-performance-app url
176+
> **modality** is to be replaced by either CT, RF, US or MR
177+
163178
#### Investigating Metrics ####
164179
##### MONAI Informatics Gateway #####
165180
- Informatics gateway will output logs detailing the time when an association was made and when a WorkflowRequest was sent. This can be seen by | grep "Payload took" which will give a hh:mm:ss between the 2 events.
@@ -189,7 +204,7 @@ Average and Peak load times are displayed as below. These tests are most valuabl
189204
#### Set Up ####
190205
- Deploy MIG and MWM to an environment including all its dependencies.
191206
- Set up MIG with AET and Destinations scripts found [here](TBD)
192-
- Seed Orthanc with Test Data from [here](TBD)
207+
- Run dotnet-performance-app
193208
- Set up Orthanc with 2 Remote Modalities, configuration can be found [here](https://book.orthanc-server.com/users/configuration.html#configuration)
194209
- MONAI - This will be send C-STORE requests to MIG with an AET "MONAI"
195210
- NOTMONAI - This will be send C-STORE requests to MIG with an AET "NOTMONAI"
@@ -203,8 +218,10 @@ Average and Peak load times are displayed as below. These tests are most valuabl
203218
cd k6
204219
```
205220
```bash
206-
k6 run -e CONFIG=config/{config}.json ORTHANC_URL={url} ORTHANC_USER={user} ORTHANC_PASS={pass} dicom/dicom_peak_avg.js --insecure-skip-tls-verify
221+
k6 run -e CONFIG=config/{config}.json URL={url} dicom/dicom_peak_avg.js --insecure-skip-tls-verify
207222
```
223+
> **url** is to be replaced by dotnet-performance-app url
224+
> **config** is to be replaced by either avgConfig.json or peakConfig.json
208225
209226
#### Investigating Metrics ####
210227
##### MONAI Informatics Gateway #####
@@ -218,4 +235,4 @@ k6 run -e CONFIG=config/{config}.json ORTHANC_URL={url} ORTHANC_USER={user} ORTH
218235
- Logs TBC
219236

220237
##### Argo #####
221-
- Grafana will be used for visualization of the hardware resources.
238+
- Grafana will be used for visualization of the hardware resources.

performance-testing/dotnet-performance-app/Controllers/DicomController.cs

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using dotnet_performance_app.Support;
22
using FellowOakDicom;
3+
using FellowOakDicom.Network;
34
using Microsoft.AspNetCore.Mvc;
45
using System.Reflection;
56

@@ -9,70 +10,38 @@ namespace dotnet_performance_app.Controllers
910
[Route("dicom")]
1011
public class DicomController : ControllerBase
1112
{
12-
public DicomController()
13+
public DicomController(IConfiguration configuration)
1314
{
15+
Host = configuration.GetValue<string>("InformaticsGateway:Host");
16+
Port = configuration.GetValue<int>("InformaticsGateway:Port");
1417
_dicomScu = new DicomScu();
1518
}
1619

20+
private string? Host { get; set; }
21+
private int Port { get; set; }
1722
private DicomScu _dicomScu { get; }
1823

19-
[Route("ct")]
2024
[HttpGet]
21-
public async Task<IActionResult> PublishCt()
25+
public async Task<IActionResult> DicomAssociation(
26+
[FromQuery(Name = "modality")] string modality,
27+
[FromQuery(Name = "CallingAET")] string CallingAET = "TEST",
28+
[FromQuery(Name = "CalledAET")] string CalledAET = "TEST")
2229
{
2330
try
2431
{
25-
await _dicomScu.CStore("127.0.0.1", 4242, "TEST", "ORTHANC", await GetDicoms(GetFolder("CT")), TimeSpan.FromSeconds(100));
26-
return Ok();
27-
}
28-
catch (Exception)
29-
{
30-
return BadRequest();
31-
}
32-
}
33-
34-
[Route("xray")]
35-
[HttpGet]
36-
public async Task<IActionResult> PublishXray()
37-
{
38-
try
39-
{
40-
await _dicomScu.CStore("127.0.0.1", 4242, "TEST", "ORTHANC", await GetDicoms(GetFolder("XRAY")), TimeSpan.FromSeconds(100));
41-
return Ok();
42-
}
43-
catch (Exception)
44-
{
45-
return BadRequest();
46-
}
47-
}
48-
49-
[Route("mri")]
50-
[HttpGet]
51-
public async Task<IActionResult> PublishMri()
52-
{
53-
try
54-
{
55-
await _dicomScu.CStore("127.0.0.1", 4242, "TEST", "ORTHANC", await GetDicoms(GetFolder("MRI")), TimeSpan.FromSeconds(100));
56-
return Ok();
57-
}
58-
catch (Exception)
59-
{
60-
return BadRequest();
61-
}
62-
}
63-
64-
[Route("ultrasound")]
65-
[HttpGet]
66-
public async Task<IActionResult> PublishUltrasound()
67-
{
68-
try
69-
{
70-
await _dicomScu.CStore("127.0.0.1", 4242, "TEST", "ORTHANC", await GetDicoms(GetFolder("ULTRASOUND")), TimeSpan.FromSeconds(100));
71-
return Ok();
32+
var result = await _dicomScu.CStore(Host, Port, CallingAET, CalledAET, await GetDicoms(GetFolder(modality.ToUpper())), TimeSpan.FromSeconds(120));
33+
if (result.State.Equals(DicomState.Success))
34+
{
35+
return Ok();
36+
}
37+
else
38+
{
39+
return BadRequest(result.Description);
40+
}
7241
}
73-
catch (Exception)
42+
catch (Exception e)
7443
{
75-
return BadRequest();
44+
return BadRequest(e.InnerException);
7645
}
7746
}
7847

performance-testing/dotnet-performance-app/Controllers/RabbitController.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

performance-testing/dotnet-performance-app/Data/WorkflowRequestEvents/WorkflowRequestEventTestData.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

performance-testing/dotnet-performance-app/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
var builder = WebApplication.CreateBuilder(args);
22

3+
builder.Configuration.AddJsonFile("appsettings.json", false, true);
4+
builder.Configuration.AddEnvironmentVariables();
35
// Add services to the container.
4-
56
builder.Services.AddControllers();
67
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
78
builder.Services.AddEndpointsApiExplorer();
@@ -18,8 +19,6 @@
1819

1920
app.UseHttpsRedirection();
2021

21-
app.UseAuthorization();
22-
2322
app.MapControllers();
2423

2524
app.Run();

performance-testing/dotnet-performance-app/Properties/launchSettings.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"windowsAuthentication": false,
55
"anonymousAuthentication": true,
66
"iisExpress": {
7-
"applicationUrl": "http://localhost:1845",
8-
"sslPort": 44301
7+
"applicationUrl": "http://localhost:1845"
98
}
109
},
1110
"profiles": {
@@ -16,7 +15,7 @@
1615
"environmentVariables": {
1716
"ASPNETCORE_ENVIRONMENT": "Development"
1817
},
19-
"applicationUrl": "https://localhost:7003;http://localhost:5003",
18+
"applicationUrl": "http://localhost:5003",
2019
"dotnetRunMessages": true
2120
},
2221
"IIS Express": {
@@ -32,7 +31,6 @@
3231
"launchBrowser": true,
3332
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
3433
"publishAllPorts": true,
35-
"useSSL": true
3634
}
3735
}
3836
}

0 commit comments

Comments
 (0)