Async vs Sync Benchmark (.NET)

Tools

  • .NET 5 Web Api application (test target)
  • Azure Sql Database
  • Azure App Service (hosts the application)
  • Azure App Insights (to gather metrics)
  • locust framework (to simulate user load).

Configuration

Experiment schema
  • a user from the locust host 1 hits the synchronous endpoint of the App Service 1, gets the response, stays idle during 0.5–1 seconds (the exact time delay is random). Repeats till the end of the experiment
  • a user from the locust host 2 behaves exactly the same, with the only one difference — he hits the asynchronous endpoint of the App Service 2.
App Services code

Metrics

  • requests per minute — shows a number of requests that the application actually processed and returned a status code
  • thread count — shows the number of threads the app service consumes
  • median response time, ms

Experiment #1

  • number of users: 75 (per service)
Experiment #1. Requests per minute
Experiment #1. Thread count
Experiment #1. Summary

Experiment #2

  • number of users: 150
Experiment #2. Requests per minute
Experiment #2. Summary

Experiment #3

  • number of users: 200
Experiment #3. Summary

Conclusion

Appendix #1. Technical details

  • Azure App Service: B1, 100 ACU, 1,75 Gb Memory, A-Series compute equivalent
  • Azure Sql Database: Standard S4: 200 DTUs, 500 Mb storage
  • Sql Connection settings: Max Pool Size=200

Appendix #2. Notes

Appendix #3. Bonus Experiment

Bonus Experiment. Requests per minute

--

--

--

My goal is to eliminate technological barriers and help businesses to grow and change the world to the best

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Programming STM32 on Linux

One Thousand and One Projects

⏰⏰⏰ONLY 4 HOURS LEFT TO NFT BLIND BOX FREE ZONE!!! ⏰

How To Run Python APIs on GCP Cloud Run

How I Learned Programming in my teenage.

Save WordPress Backup On Dropbox

Accessing Knative REST API using Fabric8 Knative Client

How to switch between cameras in Cinemachine

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Artem Mikulich

Artem Mikulich

My goal is to eliminate technological barriers and help businesses to grow and change the world to the best

More from Medium

C# Understanding Interfaces + simple mocking + testing (xUnit + NSubstitute)

Announcing Oracle Support for .NET 6 and Entity Framework Core 6

The Facilis framework for dotnet core — the plan

3 and a Half Ways to Store Configuration for Microservices in .NET