Answer the question
In order to leave comments, you need to log in
How to create multithread via docker?
Here's an example. The server has php and nodejs
PHP sends a command to a node like
node mydir/script.js https://example.com
Puppeteer is installed on the node (this is a web browser type driver) It normally cannot be run several times at the same time in one node.
And the node returns data to PHP
Everything works well BUT!
PHP can send at least 100 links to a node per second. And the node processes 1 link per second (
So I thought about how to make several threads. It can create 20 dockers with a node on the server.
But how can I do it with a docker. I
slipped the idea to make 20 dockers on 20 different ports
And then send 20 pieces from PHP.Maybe there are already run-in methods?
Answer the question
In order to leave comments, you need to log in
If you are limited to bare docker as a runtime, then you can try using scale in docker-compose for example, specifying a range of ports
services:
web:
image: "puppeteer"
ports:
- "8081-8099:8080"
scale: 10
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question