The server is waiting for request, for each request I am take a video input
( it can be RTSP input, video file .. ) and output it as 1 image.
for example -
this.stream = child_process.spawn("ffmpeg", [ "-i", this.url,
"-rtsp_transport", "tcp",'-f', 'mpeg1video', '-b:v', '800k', '-r', '30', '-'], {
detached: false
});
this.inputStreamStarted = true;
this.stream.stdout.on('data', function(data) {
return self.emit('mpeg1data', data);
});
this.stream.stderr.on('data', function(data) {
return self.emit('ffmpegError', data);
});
this is part of the code in the object I wrote, just spawning this child
process and wait for events in the wrapper.
Its not a problem that the solution is clustering or queue because each request
execute at the moment its arrive. When I open the Task Manager
I can see only 5 process of ffmpeg.exe , I tried to create manually the process
from the cmd line and still, the maximum is 4~5 processes.
Any Idea?
On Sunday, June 28, 2015 at 1:43:35 AM UTC+3, ryandesign wrote:
>
>
> On Jun 27, 2015, at 3:16 AM, Ofir Attia wrote:
>
> > I facing with issue of nodejs and spawning child process.
> > I have noticed that I can spawn at max 5 instances of ffmpeg instances.
> > I have a server that listen for requests and each request parsed as
> ffmpeg instance that working for 5 minutes.
> > The problem is that the number of the instances is limited for 5 I cant
> get more instances.
> >
> > I would like to get some advice in this subject, if you faced with this
> issue ( Not necessarily with ffmpeg ) .
>
> The web server probably shouldn't spawn long-running processes. Instead,
> have a separate process to do long-running work, and find a way to
> communicate between the web server process and the long-running work
> process. For example, using redis is popular. npm has several modules for
> helping you manage a work queue.
>
> However... I'm not sure why spawning more than 5 processes from a web
> server would be a problem. I'd need to see some code demonstrating the
> problem.
>
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/bd610254-3ddb-4fde-ab9b-9614f58284e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.