-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Many concurrent requests #2412
Comments
This screams of a common issue with full iis on non-server windows OS, what version of windows/iis are you running in (if at all)? |
Forgot to mention: I am using Selfhosting with Microsoft.Owin.Host.HttpListener. |
The best option to use nginx for static content(or another http server). |
I agree with @kiri-rin nginx is perfect for static content and then let nancy handle api related stuff. |
Well, the problem is that I also have nonstatic content that is large or takes some time to generate. |
@cody82 if you have long running routes then you should make them async so they do not block up the request threads |
Yes. So does that mean that the problem is not in the general HTTP request handling in Nancy but in the handler for static files that does not properly use async? I also experienced the same problem in ServiceStack that does most its handling asynchronous but then it calls one synchronous Socket.Write function that blocks everything. |
I have tracked the problem to GenericFileResponse.GetFileContent: private static Action<Stream> GetFileContent(string filePath, long length)
{
return stream =>
{
using (var file = File.OpenRead(filePath))
{
file.CopyTo(stream, (int)(length < BufferSize ? length : BufferSize));
}
};
} So File.CopyTo blocks the thread while the file/video is transfered. |
@cody82 I created a PartialFileResponse for video/audio streaming applications: https://gist.github.com/danbarua/0fd9fcad5ec85e0c02dc Needs a little cleaning up but could possibly be merged in to Nancy or have the functionality added to GenericFileResponse. |
Description
Nancy can not serve many(<10) concurrent requests at once.
Steps to Reproduce
System Configuration
The text was updated successfully, but these errors were encountered: