I have a .NET 2.0 web application that is used only as a background client for a client application that will send it a request with 1-500 KB of data, and the server will do some processing of this data, then query the database to create a dataset for client return - From 200 KB to 200 MB of data. Data can take up to 15 minutes to fully load from the database and up to an hour to completely transfer to the client (although typical times are pretty slightly lower - 20-second request, 10-second transfer). However, for some combinations of the database query and the client, sometimes the database is faster, sometimes the link to the client is faster.
Clients connect using different quality links — some of them over a local area network with a bandwidth of 10 MB, and some over a shared ISDN link of 64 Kbps. I have four things that I want to provide:
- The database connection should be open as short as possible.
- You must use minimal server memory.
- Data should be transmitted to the client as quickly as possible.
- The total duration of the process should be as close as possible to the maximum of the two processes (DB timeout, network transmission time), and not the sum of the time of the two processes.
As long as we have three modes, we can run the code in:
- When data is retrieved from the database, write to the response stream.
- When data is retrieved from the database, store it in memory. When the database reading is completed, close the database connection and write the data from memory to the response stream.
- , . , .
, . , , , , , , /, .
, , - , .NET( ), , HttpHandler, . , , . , . , , .
- , , , - , - , ? ?