Skip to content
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

Multiple cores #2

Open
andersekdahl opened this issue Jul 3, 2015 · 5 comments
Open

Multiple cores #2

andersekdahl opened this issue Jul 3, 2015 · 5 comments

Comments

@andersekdahl
Copy link

When using Node.js, it's common to use the cluster module to fork a process per CPU core. I don't think anyone disagrees with the performance benefits of doing that.
But since SuperchargedReact.Net only uses one V8 instance, it's comparable to using Node.js without the cluster module (unless I'm missing something?).
Are there any plans/discussions regarding this?

@PeteDuncanson
Copy link
Member

Hi @andersekdahl,

Sorry for the late replies I've been away in Paris at the ReactEurope conference.

Great point, not one I'd considered but now you've raised it I'll have to give it some thought. By default IIS should use all available cores I believe but I'm no parallel programming master.

Our first target with this code base was getting it running and running well. I think we've done that. Next I want to make it easier to get up and running with it (we are missing lots of docs) so we cna have more people using it and so more eyes on it. Then I hope to revisit the performance and see what we can do to make it even faster.

Right now its "good enough" from the testing we've been doing but of course I'm open to getting more out of it if we can. More CPU's might be one of the ways we can do that.

Regarding the single instance of V8, we keep that instance as a static variable and every request asks this instance for a need JS engine to run it. This is the fastest way to spin up a new engine context from an existing instance of V8 according to ClearScripts own forum although I can't put my hand to the link for that right now but I will.

Cheers

Pete

@PeteDuncanson
Copy link
Member

Lots of my comments on performance here include the links I mention:

reactjs/React.NET#78

@andersekdahl
Copy link
Author

Hi!
Thanks for the answers!

Sure, IIS will use all cores but since you have a single, static V8 instance all cores will be talking to the same engine (and waiting for the same engine). And a single V8 instance is single threaded even if you have multiple V8 contexts. I think it would make sense to use multiple instances (although I might be wrong, I know a lot about Node and V8 and less about how ClearScript wraps it).

@PeteDuncanson
Copy link
Member

Trouble is I'm not sure how to even go about doing this or even testing it? Any ideas?

@andersekdahl
Copy link
Author

You could test that it's true by creating a React component with a loop that takes at least a couple of seconds to complete.

If you open that page at the same time in different browsers/tabs and one of them completes long after the other, you knowbthat you have a bottleneck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants