dotnet / eShop

A reference .NET application implementing an eCommerce site
MIT License
5.72k stars 1.67k forks source link

Scalability/load tests #25

Open adityamandaleeka opened 11 months ago

adityamandaleeka commented 11 months ago

Would be interesting to see how much traffic we can handle with this architecture and where things start to break down.

ks1990cn commented 9 months ago

Interesting, how we can do this? Do you accept results by postman?

adityamandaleeka commented 8 months ago

@ks1990cn The intent here is to get automated scale/load tests going for eShop. We have some performance infrastructure that we use for ASP.NET Core (see https://github.com/dotnet/crank, which powers the benchmarks whose results are displayed on https://aka.ms/aspnet/benchmarks).

Given that, one approach here would be to identify a couple of flows in eShop and turn those into automated scenarios that Crank can run.

Once we have those, we can get fancier and do things like max latency tests (e.g. answering questions like "how high can you drive RPS while maintaing P95 latency below 5 ms?").

I suspect that as we get visibility into these numbers, we'll discover a bunch of low-hanging performance improvements that we can make since this isn't an area that people have spent much time on for this app.

ks1990cn commented 8 months ago

I've never used https://github.com/dotnet/crank, trying to understand how we can do it. I've used https://github.com/dotnet/BenchmarkDotNet before, is both similar?

adityamandaleeka commented 8 months ago

Not quite. BenchmarkDotNet is great and we use it too, but while it really shines with microbenchmarking, Crank's strength is in running tests with multiple nodes (e.g. client/server) and different load patterns, and the general coordination of things running in a dedicated performance testing environment. You can actually run BenchmarkDotNet benchmarks with Crank too.

You can find more info about Crank here and in the docs for it.

adityamandaleeka commented 8 months ago

cc @sebastienros

ks1990cn commented 8 months ago

Thanks @adityamandaleeka let me go through these docs and understand how it works. Will comeback here.

ks1990cn commented 8 months ago

@adityamandaleeka I have question here similar question I've also asked at crank repo but here its quite specific to eshop.

How we can benchmark through crank, when authentication across APIs are present in microservice architecture. Do crank provide way to test through WebApp or you want through API level only. But again I've question, what if we have authentication enabled for that API or any dependent API, do crank will be able to hit that API give right results?

sebastienros commented 8 months ago

The wrk load generator is able to run custom scripts before any request. This example https://github.com/wg/wrk/blob/master/scripts/auth.lua shows how a token can be injected in the request. And a pre-flight request can authenticate on eshop before that.

Maybe you can already get something in place while using anonymous endpoints? That would be a first step as it will also require to setup all the micro services as job instances.

ks1990cn commented 8 months ago

@sebastienros wrk is any other tool than crank? I thought we are discussing how we can do this with crank. 😕 😕

I agree on that all services must be different jobs but how crank yml file can have token passed, bit confused here!