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

Node.js #17

Open
benjamingr opened this issue May 10, 2020 · 3 comments
Open

Node.js #17

benjamingr opened this issue May 10, 2020 · 3 comments

Comments

@benjamingr
Copy link

Does a postTask API make sense for Node.js (in any way)?

I've been thinking of exploring adopting this API or experimenting with it in Node.js with the use case I've been thinking about is similar main thread contention. I have a server that serves a large number of users. That server needs to manage QoS of various levels of requests. Some requests should be very fast while for other requests I really wouldn't mind the users to wait a few milliseconds.

For example if I have a request that hashes an image and stores it for later retrieval - it might be OK for that request to wait until the CPU is idle. Work that takes more than a few milliseconds typically gets put in a (persistent) queue on servers but there is certain work I probably wouldn't mind waiting for.

The same goes for CLI tools, webpack might be interested in performing certain kinds of analysis in a lower priority than actually outputting the compiled code. TypeScript might "emit" before it's done type-checking to give users a snappier experience etc.

The main issue I see here is that Node.js already exposes threads and processes (with worker_threads and child_process) - so users already have access to the operating system scheduler. That said, it would be cool if some code could be made universal and shared here.

@shaseley
Copy link
Collaborator

Hi @benjamingr, thanks for digging in here!

I agree that it would be cool if some code could be shared here, but I'm not as familiar with use codes on the Node side of things. @sebmarkbage and @acdlite who have been working with us on this might have some thoughts?

One thing to note here is that the API is still experimental and just recently entered origin trial, so things are subject to change.

@benjamingr
Copy link
Author

One thing to note here is that the API is still experimental and just recently entered origin trial, so things are subject to change.

Thanks for the update - that is precisely why I wanted to make sure we ( Node.js ) provide feedback on it as soon as possible if it is applicable and attempt to collaborate and see if this is something we can be a consumer of.

I will also create a Node.js issue to raise the discussion there. What would be a constructive way to collaborate to figure out if this makes sense for Node.js and provide feedback?

@benjamingr
Copy link
Author

I opened an issue in the Node.js repo to make sure this isn't missed. Thanks!

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