How much cpu core is available for jail.

Status
Not open for further replies.

Plato

Contributor
Joined
Mar 24, 2016
Messages
101
At first I thought a jail could access all of the cores on the CPU on FreeNAS. But I read that jails could really only use 1 of the cores fully.

Now, I use an eight core CPU ( 4... 8 with hyperthreading ) and using Plex media server under it.

So does this mean, it is using only one core of the CPU for decoding for remux/reencode?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Jails are just an isolation layer in the kernel. Your processes are being run by the host system, with some protections that prevent it from seeing most of what's going on with the host platform. Historically, there wasn't any way to control resource usage by jails, because it was much more akin to a fancy chroot environment, but starting during FreeBSD 8, IIRC, some resource controls have been made available to limit the impact of a jail on the host system.

However, I'm pretty sure you've got this 180' wrong. If anything, FreeNAS has traditionally suffered the opposite problem: allowing users to consume too much CPU, which tends to impact the ability of the host system to run ZFS, the middleware, and filesharing protocols at peak efficiency. There has been some discussion of implementing resource limits for jails, but I don't use jails on FreeNAS and don't really know what happened with that, if anything. Being that this would have happened in the modern multicore era, if anyone did implement this, I would be shocked if anyone coded it to limit you to a single core.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
The change came about in 9.10. The Jails aren't limited to one core but the processes are all limited to nice so as not to overwhelm the base system.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
nice doesn't affect the number of cores, it just affects how the scheduler schedules userland processes.

It's been about fifteen years now that SMP support's been available in FreeBSD and other operating systems, as multi-CPU systems popped into wider existence in the early 2000's. However, it is fair to note that in many cases, we still do not do a good job of taking advantage of parallelism in host platforms. Many things today are still inherently singlethreaded, meaning single process and a single execution path within. This makes sense in many cases, but we also see examples where a multithreaded model that can take advantage of multiple CPU's would be advantageous.

It is quite possible that Plex
is using only one core of the CPU for decoding for remux/reencode
depending on what is doing that work underneath it all, However, if you have two or more clients watching separate things, I'd expect that Plex is spinning up a separate process for each client, so there is still some parallelism going on, even if it isn't making optimal use of your CPU. This is more of a question for the Plex guys, though I suspect someone around here knows enough about Plex to have a more detailed answer about what's doing the reencoding under the sheets. I know ffmpeg is supposed to be multithreaded, but there may be other stuff involved too.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Last I checked, under the sheets, plex was using ffmpeg, and ffmpeg supports multi-threaded encoding, and I believe plex uses this.

Of course, that only applies when you're doing transcoding, rather than directstreaming, or transmuxing.

BUT the CPU only really matters when you're transcoding

And you always transcode when you're burning in subtitles for rendering on device which doesn't support out-of-band subtitles.
 
Status
Not open for further replies.
Top