node-workers-example | simple example of using Redis | Runtime Evironment library
kandi X-RAY | node-workers-example Summary
kandi X-RAY | node-workers-example Summary
The application is comprised of two process:. Because these are separate processes, they can be scaled independently based on specific application needs. Read the Process Model article for a more in-depth understanding of Heroku’s process model. The web process serves the index.html and client.js files which implement a simplified example of a frontend interface that kicks off new jobs and checks in on them.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Starts the job queue
- Renders a job .
- Render the html of the job .
- Update the jobs .
- Queue a job .
- Clears all rendering
- Creates a new Promise .
node-workers-example Key Features
node-workers-example Examples and Code Snippets
Community Discussions
Trending Discussions on node-workers-example
QUESTION
I have an application that looks like this one: https://github.com/heroku-examples/node-workers-example
In short, I have 2 processes:
- Server: it server US, handles requests and adds them to Redis
- Worker: it pulls requests from Redis and works on them
Should I use only one Docker image for both processes or should I have 2 docker images (one for the server and the second for the worker)? What is the best practice?
I personally think, it's better to have 2 images. In this case, can my project structure be like this one:
...ANSWER
Answered 2020-Mar-24 at 11:57Disclaimer: this is very opinionated response, but author is asking for an opinion.
You can do one or two but it all depends on how you wanna schedule it.
If you want to stay flexible in the amount of processes you want for each I would go with two docker images otherwise you'll need to each time spin a fixed amount of each or you'll need to tweak that setting via env variables or via other means...
Hence one for the frontend part and one for the background process.
As you are having two different images, I usually prefer to separate that in two distincts projects but that's a matter of taste. Even though because of how NodeJS manages dependencies (node_modules
) it's easier to have 2 distincts folders when the dependencies are very different.
I would go with following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-workers-example
npm start
http://localhost:5000
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page