Handling Large Simultaneous HTTP POSTs in an ASP.NET Application

The client page uses javascript to send data (files) of a multi-page form to my ASP.NET site (ashx handler).

The user selects several files and starts the simultaneous download. When files look like 150 MB +, this creates several parallel POST handlers on the ASP.NET server side.

I have implemented session control, as well as the captcha function, to know for sure, not a bot flooding my server.

But the problem is with the initial launch of the download.

Each time the handler processes POST , it checks the session identifier (my user session, one per user page) and adds the Request.ContentLength size to the total size of the POST ed files per session. This data is stored in XML.

But since several initial messages occur simultaneously, the XML creator, which writes the sum of the bytes, "throttles" and reports 0 bytes per session for all initial POST s, since they enter simultaneously.

I implemented lock on my persister object (which writes XML), but now, until one POST is fully processed, the others cannot continue.

In addition, despite the fact that I do not do anything with requests that are included in the "after downloading restrictions", they still require time to upload data to the server.

So my questions are:

What is the correct template for handling multiple concurrent POST downloads?

Is there a way to immediately remove POST as soon as the request is filtered in ASP.NET handler code and save the client in an attempt to load data into IIS?

UPDATE: When lock only for calculating the record length of the XML / max session, I still have concurrency, which is good. Now I just need to figure out how to quickly remove the session from the ashx handler code.

+6
source share
1 answer

Is your ashx handler written to execute asynchronously? If not, this is a great article for implementing async ashx handlers:

http://msdn.microsoft.com/en-us/magazine/cc163463.aspx

+1
source

Source: https://habr.com/ru/post/912025/


All Articles