Bug 16983 - xsp/monofastcgi/others should not use the threadpool for each received WebRequest
Summary: xsp/monofastcgi/others should not use the threadpool for each received WebReq...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-12-29 08:33 UTC by Andres G. Aragoneses
Modified: 2013-12-29 08:33 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 16983 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Andres G. Aragoneses 2013-12-29 08:33:59 UTC
(I'm using product Tools->Other because I don't find one for http://github.com/mono/xsp)

There's a threadpool exhaustion scenario which a user is very likely to hit if he hosts his webservice/webapp with XSP/mono-fastcgi/etc. This happens specially when for a certain type of webrequest, the implementation of its response requires contacting other webservices or using async features (i.e. launching parallel webrequests). In this case, the use of the threadpool by the user's app can affect the use of the threadpool that xsp/monofastcgi/etc use for serving requests, degrading the scalability factor of the overall service.

Furthermore, threadpool usage is only recommended for "short tasks" (just google for the three words 'short' 'tasks' 'threadpool' and you will find a lot of documentation about this, even from MSDN), so xsp/mono-fastcgi/etc usage of the threadpool is wrong to begin with, because from their point of view they cannot know if the task to be done is short.

This could be solved if the threadpool had API to distinguish between different priorities (then we could assign "high" priority for xsp/monofastcgi/etc's usage of the threadpool, and hopefully the other normal "low" default priority usage of the threadpool would never exhaust the set of "high priority" threads reserved by the threadpool), but it doesn't. So what I propose is that xsp/monofastcgi/etc should use its own threadpool instead.

The SmartThreadPool library could be used (http://smartthreadpool.codeplex.com/ , MS-PL licence) in order to not complicate things too much. Some example of its usage is here: http://www.codeproject.com/Articles/7933/Smart-Thread-Pool