I have developed a RESTful api that I deployed on Azure Web App. While performing the load test using JMeter, I see that the response time is huge i.e ~18secs. This response time appalls me because the endpoint I have exposed only receives a ~1-2KB of text data and enqueues it to azure service bus queue.
I have researched and found the following:
- Azure Web App and Queue needs to be in the same region. Yes they are
- Size of the VM matters. Mine is S3 Large
- Software Design needs to be good/optimized. Controller only enqueues, no other operations
For load testing, I have provisioned a VM instance in the same region as the Azure Web App to minimize the latency. The enqueue statement takes time in the order of milliseconds, so I wonder what is taking the extra seconds while the serivce is in load?
My code creates a single instance of QueueClient which I reuse for all requests. The code is just the following two lines inside an ApiController
ServiceBusManager.GetQueueWriter().Enqueue(data); //data is no more than ~1KB
return Request.CreateResponse(HttpStatusCode.OK, "Data enqueued");