What should my expectation be for baseline RPS for

2020-07-27 15:58发布

问题:

I'm trying to gauge baseline RPS for a Web API developed in .NET Core 2. Here are the steps I've followed so far

  • Generated a new/empty Web API project from Microsoft's baked in VS templates
  • Added a new Controller that performs a basic "hello, you're api end-point is working" response with no logic and no additional I/O processing
  • Deployed to Azure as a App Service. For service plan selected P3 (P3=400 total ACU, 7GB, $800/month) and set instance count to max of 20.
  • Loaded JMeter and set a HTTP Request load test to simulate load spikes. I found that anything above 530 concurrent request and I start to get HTTP errors reported by JMeter and delayed responses if I try to make the request in a browser during this spike.
  • I'm confused as to why the compute power/scale I have configured can't handle over 530 simultaneous request on a baseline .net core 2 controller. I'm trying to get an answer to if this is normal. Was wondering if perhaps there are some optimization points I might be missing? I went with a baseline .NET Core web service implementation because I want to start with a code base that I knew for certain could not be further optimized so I can focus on compute needs first.

If these are the expected results for a baseline .NET Core 2 web service hosted in Azure, then it looks like we're going to have to spend a lot more money as we're hoping to be able to handle over 3000 concurrent request without response time/latency going above 30 seconds during spikes. As far as auto-load balancing goes, the spikes come at random times in our instance. I can't get into details but there is absolutely no way to determine when these spikes will hit, it's a pretty unique business case, but unavoidable.

I'm also wondering if JMeter is the best tool to validate these results. It seems a respected tool, If anyone has had luck with other load testing tools please recommend.

Here is all I have going on in the configuration/service startup from Startup.cs

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseHsts();
    }

    // TO DO: build whitelist
    //    app.UseCors(
    //  options => options.WithOrigins("http://example.com").AllowAnyMethod() );
    app.UseCors(options => options.WithOrigins("*").AllowAnyMethod());
    app.UseHttpsRedirection();
    app.UseMvc();

}

and also

public void ConfigureServices(IServiceCollection services)
{
   // ADDCors during test stages
    services.AddCors();


    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);


}

回答1:

.NET core is very decent in terms of handling high RPS . There are many factors when you run these sort of tests and design application which could based of the following but not limited to.

.NET Core Version

You simply mentioned you are using .NET Core 2. Just to be aware there are several .NET Core 2.X versions and there is considerable performance difference between.NET 2.0 and .NET 2.2 . If you want to find out more about performance difference please follow Jon Galloway's from Microsoft in the following link. https://www.youtube.com/watch?v=04SmFYwLPwM&feature=youtu.be&list=LLxfaEBq0Fa7eiKokf98ojxA&t=167

Bench Marks

You may find different bench marks based on personal experiences but i prefer techempower which is run by community. https://www.techempower.com/benchmarks/

Performance testing tools

JMeter is nice Performance testing tool and the response time you mentioned is very high which should ideally be in milliseconds so some thing is not right and definitely needs investigation. You can use Azure Performance test tool to validate your tests. The azure performance test tool give you deeper insights. https://docs.microsoft.com/en-us/azure/devops/test/load-test/app-service-web-app-performance-test?view=vsts

Handling Spikes

When you are testing spikes with Azure Web Apps, you need to be aware of few things. Azure Web Apps is good choice if you are aware of your web load. Handling spikes with Azure Web apps could be challenging. You need to be aware if your spike is causing the new instance to provision it may take few minutes for the new VM to handle the requests and normally you have to over provision the VMs to handle spikes which could be costly choice.

you would prefer Containers (e.g. Docker) + Orchestrator (e.g. Azure Kubernetes) or Serverless (Azure Functions) or both to handle the spikes and they specifically are designed for this and adjust to spikes almost instantly.

When you architect application to handle high RPS it could be based on following but not limited to Region you select, choice of Cloud service (Azure Web Apps, Containers, Serverless, VMS) , Intelligently caching , Database , Scaling metrics and choice of language. There is not single answer and is really depends on what you are trying to achieve.

Additional Tools and testing

Application insights from Microsoft is very powerful tool to get a deeper look into your performance testing. When you are testing with Azure, always provision Application insight to validate your results.

Run different test combinations like higher user ramp up time , Over provision Azure Web Apps instances , Choice of OS (Linux and windows), have combination of different monitoring tools to land on some comparable results.

Hope that helps!



标签: c# azure jmeter