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
Nuxt 3: Workers #15
Comments
Do you have plans for this to support |
@pimlie Sure. I'm not just started it. BTW would you please attach the link to your related works and hints for generating to this topic? That would be really helpful.
Indeed planned too. Not just Inter Process communication workers. |
My thoughts with regards to the future of nuxt-generate-cluster (ngc). These thoughts should be read as in an ideal world because looking at the download count of ngc I dont think the need for this is large enough and therefore not (yet) worth the full effort. But we could probably pick certain features. Present situationngc uses the cluster package to support multi-threaded generating, mostly useful when you have a large number of dynamic routes. When running ngc it starts a master which is responsible for:
Both master as workers use the same nuxt Messaging between master and workers is done through the IPC channel which the Cluster package provides. Disadvantages
WishlistIn general this is to run ngc daemonised and support infinite scaling. Fully support: Needed/wished features
Main difficultyFind a suitable messaging protocol, preferably one that understand a master, proxies and services. In ngc I implemented a (maybe poor-man's) message-broker as a proof of concept for this.
There is probably a lot more to say about this but I am dried-up for the moment. Will continue in another comment if I think of other things :) |
Can we close this one @pi0 ? |
Clarification: After huge efforts on this solution we decided to discontinue because of architucture complexities it brings. Alternative approach is rewriting nuxt3 server engine in a way that can be embeded as a serverless function or worker (for |
Meta
Working branch: pi0/feat/workersObjectives
nuxt dev
run and reload whennuxt.config.js
is being changed. So we don't have any memory leaks.@nuxt/cli
dependency fromnuxt-start
for making it fast as 🚀Description
The requirement is that for forking a new process (Cluster Worker) or running in a new context, we need an entry point, which should be fast, standalone and most important accepting arguments like cli commands. The simplest solution is to execute our cli script on each worker but it not only adds lot's of overhead but also makes problems for Cluster.
The proposed idea is creating embeddable standalone code that will be executed by normal CLI commands or directly by cluster runners. For passing arguments to them, we can pass a JSON argument as the only argument like this:
This makes them small because we don't need to depend on any argv parser also powerful as we can pass any kind of args without extra configs.
Remarks
nuxt.config
and mostly create a newNuxt
instance.Workers
Workers are emebeded recepies to do certain tasks. They can hopefuly will replace all CLI logics as well as custom programatic usage for use cases like Lambda/Serverless.
Server
Builder
Combinitions [TODO]
We combine workers in different use cases.
Start
Dev
The text was updated successfully, but these errors were encountered: