Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Isolate FFMPEG on a dedicated CPU
13-01-2020, 19:08
Post: #21
RE: Isolate FFMPEG on a dedicated CPU
I think the most efficient way to do this is to do a script that launch ffmpeg, then get it PID and make a taskset for the relevant PID
Find all posts by this user
Quote this message in a reply
13-01-2020, 19:47
Post: #22
RE: Isolate FFMPEG on a dedicated CPU
Simon was absolutely right. This script operate as expected :

Code:
#!/bin/bash

taskset -c 3 /usr/bin/ffmpeg "$@"
exit

Now it's time to check the minimserver.service file. Simon, do you have any advice where to find it on debian 10 ?

Or how to set CPUaffinity for Minimser at boot ?

Thank,
Manu
Find all posts by this user
Quote this message in a reply
13-01-2020, 22:10
Post: #23
RE: Isolate FFMPEG on a dedicated CPU
I installed Debian 10 to check this. It has support for SysVinit as well as systemd. In this situation, MinimServer chooses to use SysVinit and creates a minimserver file in the /etc/init.d directory. It is not advisable to try to modify the /etc/init.d/minimserver file to set processor affinity for the MinimServer process because the minimserver/bin/setup script reads and parses this file in some situations.

The best way to do what you want is to create a file in the minimserver/etc directory named minimstart.conf and containing just the following line:

JAVA=taskset -c 3 java
Find all posts by this user
Quote this message in a reply
14-01-2020, 08:28 (This post was last modified: 14-01-2020 08:29 by lafuente.)
Post: #24
RE: Isolate FFMPEG on a dedicated CPU
Hello Simon,

Thank. Unfortunately this don't operate as expected. I've done a chmod 755 on the file 'minimstart.conf' to see what happen and it doesn't change anything.

Is this trick operate with your test system ?

you can check which process runs on CPU 2 and 3 with this command line :

ps -eo psr,command | tr -s " " | grep "^ [2|3]"

Thank,
Manu
Find all posts by this user
Quote this message in a reply
14-01-2020, 15:53
Post: #25
RE: Isolate FFMPEG on a dedicated CPU
I checked this and found why it isn't working.

1) The line should start java= and not JAVA=

2) You need to do the same as you did for ffmpeg: create a script that invokes java via taskset and put the path to this script in the java= line in minimstart.conf. Unlike the ffmpeg script, this script can have any name (I used runjava.sh). The runjava.sh script needs chmod 755 but you don't need this for the minimstart.conf file because this file is being read by the startd script, not executed.

3) For this use of taskset to launch java, it is important that the java process is run as a direct child of the startd process. To make this happen, you need to put exec before taskset, like this:

exec taskset -c 3 java "$@"

It would be a good idea to add the exec for ffmpeg as well.
Find all posts by this user
Quote this message in a reply
15-01-2020, 08:26
Post: #26
RE: Isolate FFMPEG on a dedicated CPU
Thank Simon.

I confirm that this method is OK.
Did you try this trick and found any improvement ?

First thing to do is to use "isolcpus" in grub.conf to exclude 2 cores from the linux scheduler, than to put scripts like we discuss to have minim running on one excluded cpu and ffmpeg on the other.
Find all posts by this user
Quote this message in a reply
15-01-2020, 09:25
Post: #27
RE: Isolate FFMPEG on a dedicated CPU
I don't have a 4-core processor to try this on. Also, I run MinimServer on a Melco which has only a single core and the sound quality is excellent. Smile

Did you compare having MinimServer and FFmpeg on the same isolated CPU with having them on different isolated CPUs? Which of these do you think sounds better?
Find all posts by this user
Quote this message in a reply
16-01-2020, 12:25
Post: #28
RE: Isolate FFMPEG on a dedicated CPU
(15-01-2020 09:25)simoncn Wrote:  Did you compare having MinimServer and FFmpeg on the same isolated CPU with having them on different isolated CPUs? Which of these do you think sounds better?

I didn't tried yet. Will do and report.
Find all posts by this user
Quote this message in a reply
09-02-2020, 11:24
Post: #29
RE: Isolate FFMPEG on a dedicated CPU
I finally give a try to use the same core for ffmpeg+minim vs one core for each. There is no sensible difference.
In fact, when using ffmpeg for transcode, the transcode is done at the very beginning of the reading process, and only last a few time. I don't know if the transcode file is really a temp file or in ram.
Find all posts by this user
Quote this message in a reply
09-02-2020, 15:34
Post: #30
RE: Isolate FFMPEG on a dedicated CPU
Thanks for this information.

Transcoding is done to RAM. If it only happens for a short time, it must be a small file.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)