-
Notifications
You must be signed in to change notification settings - Fork 926
Always return JS engine to pool after component render. #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This allows other threads to use available engines while other MVC actions are being processed during a page render.
On some of my pages, I render 2 or 3 separate components (i.e. 2 or 3 Html.React calls). Some of these calls are in Html.Partial. Will this change cause any issues? |
Nope, you should be just fine. |
Thanks! The only issue I can think of is if someone is relying on global state - For instance, if one component's Could you please add a unit test, at least for the |
FWIW we've been running this fix in production for a week now and have had no problems so far! 🎉 |
dustin - how is it going after a month or so? |
Really well so far. One time one of the pooled v8 engines got in a weird On Sun, Jul 17, 2016 at 11:15 Bill Bell [email protected] wrote:
|
The fix appears to be in NuGet - v2.4 - right? Can we get a blog entry for 2.5? http://reactjs.net/blog/ |
OK 2.4 is the latest - 2.5 was for Core stuff changing. |
Hello. I ask because I still get the following exception when Load Testing: When I set the React config that stops JS pooling, the Exhausted exception goes away but the performance is adversely affected: Thanks |
@Daniel15 @dustinsoftware More than a year ago, Daniil Sokolyuk developed his own implementation of the JSPool specifically for high-load sites. |
OK thanks. I can see the #270 fix in the source of React.Core\ReactEnvironment.cs. |
You'll need to change your configuration to increase your max engines. You're most likely running out of engines in the pool when load gets high and it takes several seconds to execute the script |
@DaniilSokolyuk could you provide some context to the optimization? What was the bottleneck in @Daniel15 's JSPool implementation? I'm thinking of implementing my custom high-load JSPool using AsyncEx AsyncCollection. Daniel15's implementation uses BlockingCollection, which blocks threads from the ThreadPool. As load goes up, number of threads that get blocked goes up, available threads to serve non-React views goes down and the whole system slows to a crawl. |
@huan086 Hi! I now reimplement JsPool i make it truly async without thread starvation |
@DaniilSokolyuk I’d be open to making it so the implementation of engine pooling is swappable, so consumers can choose either jspool or your implementation (or maybe your changes can go upstream into JSPool itself..) |
I'd be happy to accept pull requests to JsPool if you're willing to submit them 😃 |
ReactJS.Net has sync API,make JsPool async without change ReactJS.Net not make a sense, and in legacy asp you can’t use await in views, it will work only in asp net core |
This allows other threads to use available engines while other MVC actions are being processed during a page render.