Skip to content
Merged

Dev #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The request is processed in 'HandleAsync' method which returns a strongly typed

### Service Registration

Use AddModEndpointsFromAssembly extension method to register all endpoints defined in an assembly.
Use AddModEndpointsFromAssembly or AddModEndpointsFromAssemblyContaining<T> extension method to register all endpoints defined in an assembly.

Optional: Use FluentValidation.DependencyInjectionExtensions package to add FluentValidation validators to dependency injection for request validation.

Expand All @@ -55,7 +55,7 @@ These methods register and map services required for all endpoint types.
``` csharp
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddModEndpointsFromAssembly(typeof(MyEndpoint).Assembly);
builder.Services.AddModEndpointsFromAssemblyContaining<MyEndpoint>();
//Validation
builder.Services.AddValidatorsFromAssemblyContaining<MyValidator>(includeInternalTypes: true);

Expand Down Expand Up @@ -353,7 +353,7 @@ MinimalEndpoints perform about same as regular Minimal Apis.

The web apis called for tests, perform only in-process operations like resolving dependency, validating input, calling local methods with no network or disk I/O.

See [test results](./samples/BenchmarkWebApi/BenchmarkFiles/inprocess_benchmark_results.txt) under [BenchmarkFiles](https://github.com/modabas/ModEndpoints/tree/main/samples/BenchmarkWebApi/BenchmarkFiles) folder of BenchmarkWebApi project for detailed results and test scripts.
See [test results](./samples/BenchmarkWebApi/BenchmarkFiles/Results/0.6.5/inprocess_benchmark_results.txt) under [BenchmarkFiles](https://github.com/modabas/ModEndpoints/tree/main/samples/BenchmarkWebApi/BenchmarkFiles) folder of BenchmarkWebApi project for detailed results and test scripts.

## Endpoint Types

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
 k6  .\k6 run minimal_api_basic.js

/\ Grafana /‾‾/
/\ / \ |\ __ / /
/ \/ \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ __________ \ |_|\_\ \_____/

execution: local
script: minimal_api_basic.js
output: -

scenarios: (100.00%) 1 scenario, 100 max VUs, 2m20s max duration (incl. graceful stop):
* default: Up to 100 looping VUs for 1m50s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)


✓ status was 200

checks.........................: 100.00% 8240792 out of 8240792
data_received..................: 1.4 GB 13 MB/s
data_sent......................: 841 MB 7.6 MB/s
http_req_blocked...............: avg=3.22µs min=0s med=0s max=38.46ms p(90)=0s p(95)=0s
http_req_connecting............: avg=7ns min=0s med=0s max=2.54ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=921.27µs min=0s med=999.6µs max=73.43ms p(90)=1.99ms p(95)=2.05ms
{ expected_response:true }...: avg=921.27µs min=0s med=999.6µs max=73.43ms p(90)=1.99ms p(95)=2.05ms
http_req_failed................: 0.00% 0 out of 8240792
http_req_receiving.............: avg=31.91µs min=0s med=0s max=70.47ms p(90)=0s p(95)=0s
http_req_sending...............: avg=10.25µs min=0s med=0s max=58.65ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=879.1µs min=0s med=999.4µs max=73.43ms p(90)=1.87ms p(95)=2.02ms
http_reqs......................: 8240792 74916.177037/s
iteration_duration.............: avg=1.01ms min=0s med=1ms max=80.43ms p(90)=2ms p(95)=2.32ms
iterations.....................: 8240792 74916.177037/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 8240792 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s


 k6  .\k6 run minimal_endpoint_basic.js

/\ Grafana /‾‾/
/\ / \ |\ __ / /
/ \/ \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ __________ \ |_|\_\ \_____/

execution: local
script: minimal_endpoint_basic.js
output: -

scenarios: (100.00%) 1 scenario, 100 max VUs, 2m20s max duration (incl. graceful stop):
* default: Up to 100 looping VUs for 1m50s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)


✓ status was 200

checks.........................: 100.00% 8101231 out of 8101231
data_received..................: 1.4 GB 13 MB/s
data_sent......................: 867 MB 7.9 MB/s
http_req_blocked...............: avg=3.13µs min=0s med=0s max=53.35ms p(90)=0s p(95)=0s
http_req_connecting............: avg=10ns min=0s med=0s max=15.67ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=942.4µs min=0s med=1ms max=79.74ms p(90)=1.9ms p(95)=2.2ms
{ expected_response:true }...: avg=942.4µs min=0s med=1ms max=79.74ms p(90)=1.9ms p(95)=2.2ms
http_req_failed................: 0.00% 0 out of 8101231
http_req_receiving.............: avg=31.66µs min=0s med=0s max=49.47ms p(90)=0s p(95)=0s
http_req_sending...............: avg=9.95µs min=0s med=0s max=45.94ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=900.79µs min=0s med=1ms max=79.19ms p(90)=1.8ms p(95)=2.14ms
http_reqs......................: 8101231 73647.482907/s
iteration_duration.............: avg=1.03ms min=0s med=1.01ms max=79.74ms p(90)=2ms p(95)=2.36ms
iterations.....................: 8101231 73647.482907/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 8101231 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s


 k6  .\k6 run webresult_endpoint_basic.js

/\ Grafana /‾‾/
/\ / \ |\ __ / /
/ \/ \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ __________ \ |_|\_\ \_____/

execution: local
script: webresult_endpoint_basic.js
output: -

scenarios: (100.00%) 1 scenario, 100 max VUs, 2m20s max duration (incl. graceful stop):
* default: Up to 100 looping VUs for 1m50s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)


✓ status was 200

checks.........................: 100.00% 7848931 out of 7848931
data_received..................: 1.3 GB 12 MB/s
data_sent......................: 856 MB 7.8 MB/s
http_req_blocked...............: avg=3.26µs min=0s med=0s max=61.26ms p(90)=0s p(95)=0s
http_req_connecting............: avg=8ns min=0s med=0s max=2.36ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=974.65µs min=0s med=1ms max=98.18ms p(90)=1.99ms p(95)=2.04ms
{ expected_response:true }...: avg=974.65µs min=0s med=1ms max=98.18ms p(90)=1.99ms p(95)=2.04ms
http_req_failed................: 0.00% 0 out of 7848931
http_req_receiving.............: avg=32.4µs min=0s med=0s max=56.13ms p(90)=0s p(95)=0s
http_req_sending...............: avg=10.34µs min=0s med=0s max=56.72ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=931.89µs min=0s med=999.8µs max=98.18ms p(90)=1.99ms p(95)=2.02ms
http_reqs......................: 7848931 71353.491423/s
iteration_duration.............: avg=1.06ms min=0s med=1ms max=100.18ms p(90)=2ms p(95)=2.24ms
iterations.....................: 7848931 71353.491423/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 7848931 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
 k6  .\k6 run regular_endpoint_inprocess.js
 k6  .\k6 run minimal_api_inprocess.js

/\ Grafana /‾‾/
/\ / \ |\ __ / /
Expand All @@ -7,7 +7,7 @@
/ __________ \ |_|\_\ \_____/

execution: local
script: regular_endpoint_inprocess.js
script: minimal_api_inprocess.js
output: -

scenarios: (100.00%) 1 scenario, 100 max VUs, 2m20s max duration (incl. graceful stop):
Expand All @@ -16,26 +16,26 @@

✓ status was 200

checks.........................: 100.00% 5737012 out of 5737012
checks.........................: 100.00% 5752768 out of 5752768
data_received..................: 1.1 GB 9.8 MB/s
data_sent......................: 1.4 GB 13 MB/s
http_req_blocked...............: avg=4.24µs min=0s med=0s max=40.69ms p(90)=0s p(95)=0s
http_req_connecting............: avg=14ns min=0s med=0s max=6.32ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.31ms min=0s med=1.01ms max=138.53ms p(90)=2.23ms p(95)=2.67ms
{ expected_response:true }...: avg=1.31ms min=0s med=1.01ms max=138.53ms p(90)=2.23ms p(95)=2.67ms
http_req_failed................: 0.00% 0 out of 5737012
http_req_receiving.............: avg=48.01µs min=0s med=0s max=105.22ms p(90)=0s p(95)=0s
http_req_sending...............: avg=19.74µs min=0s med=0s max=113.35ms p(90)=0s p(95)=0s
http_req_blocked...............: avg=3.98µs min=0s med=0s max=47.4ms p(90)=0s p(95)=0s
http_req_connecting............: avg=13ns min=0s med=0s max=3.4ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.31ms min=0s med=1.04ms max=103.01ms p(90)=2.18ms p(95)=2.55ms
{ expected_response:true }...: avg=1.31ms min=0s med=1.04ms max=103.01ms p(90)=2.18ms p(95)=2.55ms
http_req_failed................: 0.00% 0 out of 5752768
http_req_receiving.............: avg=45.46µs min=0s med=0s max=70.56ms p(90)=0s p(95)=0s
http_req_sending...............: avg=19µs min=0s med=0s max=62.5ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.24ms min=0s med=1.01ms max=115.25ms p(90)=2.15ms p(95)=2.58ms
http_reqs......................: 5737012 52154.385571/s
iteration_duration.............: avg=1.46ms min=0s med=1.13ms max=142.44ms p(90)=2.49ms p(95)=3ms
iterations.....................: 5737012 52154.385571/s
http_req_waiting...............: avg=1.25ms min=0s med=1.01ms max=100.94ms p(90)=2.11ms p(95)=2.52ms
http_reqs......................: 5752768 52297.803382/s
iteration_duration.............: avg=1.46ms min=0s med=1.27ms max=103.01ms p(90)=2.43ms p(95)=2.89ms
iterations.....................: 5752768 52297.803382/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 5737012 complete and 0 interrupted iterations
running (1m50.0s), 000/100 VUs, 5752768 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s


Expand All @@ -57,26 +57,26 @@ default ✓ [======================================] 000/100 VUs 1m50s

✓ status was 200

checks.........................: 100.00% 5724672 out of 5724672
checks.........................: 100.00% 5719673 out of 5719673
data_received..................: 1.1 GB 9.7 MB/s
data_sent......................: 1.4 GB 13 MB/s
http_req_blocked...............: avg=4.26µs min=0s med=0s max=37.67ms p(90)=0s p(95)=0s
http_req_connecting............: avg=13ns min=0s med=0s max=2.6ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.31ms min=0s med=1.01ms max=94.15ms p(90)=2.26ms p(95)=2.67ms
{ expected_response:true }...: avg=1.31ms min=0s med=1.01ms max=94.15ms p(90)=2.26ms p(95)=2.67ms
http_req_failed................: 0.00% 0 out of 5724672
http_req_receiving.............: avg=46.72µs min=0s med=0s max=75.82ms p(90)=0s p(95)=0s
http_req_sending...............: avg=19.92µs min=0s med=0s max=64.82ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.25ms min=0s med=1.01ms max=94.15ms p(90)=2.18ms p(95)=2.58ms
http_reqs......................: 5724672 52042.396935/s
iteration_duration.............: avg=1.47ms min=0s med=1.2ms max=95.15ms p(90)=2.5ms p(95)=2.99ms
iterations.....................: 5724672 52042.396935/s
http_req_blocked...............: avg=4.16µs min=0s med=0s max=32.38ms p(90)=0s p(95)=0s
http_req_connecting............: avg=13ns min=0s med=0s max=2.05ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.31ms min=0s med=1.01ms max=104.59ms p(90)=2.21ms p(95)=2.59ms
{ expected_response:true }...: avg=1.31ms min=0s med=1.01ms max=104.59ms p(90)=2.21ms p(95)=2.59ms
http_req_failed................: 0.00% 0 out of 5719673
http_req_receiving.............: avg=46.32µs min=0s med=0s max=84.82ms p(90)=0s p(95)=0s
http_req_sending...............: avg=19.39µs min=0s med=0s max=65.45ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.25ms min=0s med=1.01ms max=78.82ms p(90)=2.12ms p(95)=2.54ms
http_reqs......................: 5719673 51996.796171/s
iteration_duration.............: avg=1.47ms min=0s med=1.21ms max=107.83ms p(90)=2.5ms p(95)=2.99ms
iterations.....................: 5719673 51996.796171/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 5724672 complete and 0 interrupted iterations
running (1m50.0s), 000/100 VUs, 5719673 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s


Expand All @@ -98,24 +98,24 @@ default ✓ [======================================] 000/100 VUs 1m50s

✓ status was 200

checks.........................: 100.00% 5690098 out of 5690098
data_received..................: 1.1 GB 9.7 MB/s
checks.........................: 100.00% 5601694 out of 5601694
data_received..................: 1.0 GB 9.5 MB/s
data_sent......................: 1.4 GB 13 MB/s
http_req_blocked...............: avg=4.12µs min=0s med=0s max=50.53ms p(90)=0s p(95)=0s
http_req_connecting............: avg=13ns min=0s med=0s max=3.95ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.32ms min=0s med=1.02ms max=102.88ms p(90)=2.3ms p(95)=2.7ms
{ expected_response:true }...: avg=1.32ms min=0s med=1.02ms max=102.88ms p(90)=2.3ms p(95)=2.7ms
http_req_failed................: 0.00% 0 out of 5690098
http_req_receiving.............: avg=45.89µs min=0s med=0s max=94.8ms p(90)=0s p(95)=0s
http_req_sending...............: avg=19.48µs min=0s med=0s max=58.27ms p(90)=0s p(95)=0s
http_req_blocked...............: avg=4.23µs min=0s med=0s max=32.32ms p(90)=0s p(95)=0s
http_req_connecting............: avg=14ns min=0s med=0s max=7.35ms p(90)=0s p(95)=0s
✓ http_req_duration..............: avg=1.34ms min=0s med=1.08ms max=105.89ms p(90)=2.27ms p(95)=2.62ms
{ expected_response:true }...: avg=1.34ms min=0s med=1.08ms max=105.89ms p(90)=2.27ms p(95)=2.62ms
http_req_failed................: 0.00% 0 out of 5601694
http_req_receiving.............: avg=50.15µs min=0s med=0s max=79.29ms p(90)=0s p(95)=0s
http_req_sending...............: avg=20.22µs min=0s med=0s max=60.37ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.26ms min=0s med=1.01ms max=91.25ms p(90)=2.22ms p(95)=2.59ms
http_reqs......................: 5690098 51727.985927/s
iteration_duration.............: avg=1.47ms min=0s med=1.24ms max=103.39ms p(90)=2.51ms p(95)=2.99ms
iterations.....................: 5690098 51727.985927/s
http_req_waiting...............: avg=1.27ms min=0s med=1.02ms max=105.89ms p(90)=2.19ms p(95)=2.56ms
http_reqs......................: 5601694 50924.317396/s
iteration_duration.............: avg=1.5ms min=0s med=1.33ms max=105.89ms p(90)=2.5ms p(95)=2.99ms
iterations.....................: 5601694 50924.317396/s
vus............................: 1 min=1 max=100
vus_max........................: 100 min=100 max=100


running (1m50.0s), 000/100 VUs, 5690098 complete and 0 interrupted iterations
running (1m50.0s), 000/100 VUs, 5601694 complete and 0 interrupted iterations
default ✓ [======================================] 000/100 VUs 1m50s
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const options = {

// Simulated user behavior
export default function () {
let res = http.get("http://localhost:5102/RegularEndpoints/BasicTest/");
let res = http.get("http://localhost:5102/MinimalApis/BasicTest/");
// Validate response status
check(res, { "status was 200": (r) => r.status == 200 });
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function () {
timeout: 2000,
};
let data = { name: 'Elizabeth' };
let res = http.post("http://localhost:5102/RegularEndpoints/InProcessTest/2f81c55e-22e7-4410-96de-8a8559cec357", JSON.stringify(data), params);
let res = http.post("http://localhost:5102/MinimalApis/InProcessTest/2f81c55e-22e7-4410-96de-8a8559cec357", JSON.stringify(data), params);
// Validate response status
check(res, { "status was 200": (r) => r.status == 200 });
}
Loading