1

RESOLUTION

I decided to try out a different load-testing tool, Apache Bench, and the results were markedly different. AB did not show any of the slowdown and the throughput on the save.ashx handler now processes about 1200 requests/second. So after several days of testing, the load-testing tool was at fault. ASP.NET and IIS are fine.

ORIGINAL QUESTION

I'm building an ASP.NET site designed to collect a large amount of data from HTTP posts in a very short period of time. Think form sign-ups for a Superbowl ad. There's no actual page viewing involved, that's all handled on a separate system.

To keep things as simple as possible, I'm using a generic handler (ashx) to capture the form signup data. The handler simply reads a few form values and writes the data to a static ConcurrentQueue. The code is essentially this:

public void ProcessRequest(HttpContext context)
{
    var formSubmission = new FormSubmission();
    var form = context.Request.Form;
    formSubmission.EmailAddress = form["EmailAddress"];
    formSubmission.PostalCode = form["PostalCode"];

    FormSubmissionQueue.Queue.Enqueue(formSubmission);
    context.Response.End();
}

What's happening when I try to load test this with a lot of concurrent connections (500) the first 100-200 posts are processed quickly, then everything pauses for a moment and then another quick batch goes and then a slight pause, etc.

I've tried profiling the site without much success and I'm beginning to think the slowdown is either related to garbage collection or threading, but don't know exactly where to look. I see identical behavior on IIS Express (8.1) and on an Azure website.

Can anyone suggest a place to look or settings to tweak? Am I just at the limit of what IIS can do? On my local machine (Surface Pro i5) I'm getting through all 500 posts in about 4-5 (edit, now 1.5) seconds.

Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87
  • What does the CPU usage say? Have you profiled the application with a memory profiler? Are you sure you are not keeping a reference to the session or the request context somewhere? If you don't need sessions, try disabling them to speed things up. It's difficult to guess just looking at this short code snippet, but an ASP.NET application on a decent server should handle much more than 500 simple form post requests in 4-5 seconds. – slvnperron Jan 26 '15 at 01:36
  • Sessions are off in the web.config file: . I'll try a memory profiler. The code snippet really is all that's running. I just noticed I failed to include a Response.Close() in my first example and adding that did speed things up. Now I'm looking at around 1.5 seconds for 500 form posts. CPU never gets above 40%. – Brian Vallelunga Jan 26 '15 at 01:42
  • I would then suspect a memory leak or something. There's a limit to the number of concurrent requests IIS will handle, and closing the request did indeed increase the performances since you didn't have to wait for GC to do it by himself. Try the memory profiler and see if there's a growing count of objects related to user requests. – slvnperron Jan 26 '15 at 01:48
  • But I'd say that you are now at 330 requests / second / server which is pretty decent. – slvnperron Jan 26 '15 at 01:49

1 Answers1

0

The problem ended up being the load-testing tool I was using. See the note in the above question.

Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87