• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Where's the bottleneck?



Thanks: 68
Messages: 2,051

I have setup TVheadend under FreeBSD and can watch TV programs on an Android tablet using Kodi. Sometimes I get quite a lot of buffering but I'm amazed it works at all.

I'm trying to figure out how I could improve performance, but have no idea where any bottleneck would lie.

FreeBSD 11.1-RELEASE is running on a Lenovo Ideacentre Q180, which has 4GB of memory and a 500GB hard disk. TVheadend receives TV signals via a USB DVB-T2 TV dongle (Afatech AF9033 (DVB-T)). The box is connected to a wifi/router via a LAN cable although it is only currently operating at 100Mbps since I can't find a FreeBSD driver for the 1Gb Realtek NIC. The tablet is a Lenovo Yoga Tablet 2 running Android 5.0.1 and Kodi v17.6 Krypton. It is connected via wifi to the router.

Where should I look to improve performance?

My initial thought was that the LAN connection might be the bottleneck, but even at 100Mbps it's still probably faster than the wifi link

As far as TV dongles go, is there much difference between them?


Aspiring Daemon

Thanks: 131
Messages: 854

In my house WiFi sucks. Yeah the tablets and cell phones use it, but most everything else is wired. A bottleneck (or choke point) is any point where 'A' is getting choked from reaching 'Z'. So this includes:
  • TV signals getting through a card, onto the system bus, to the CPU.
  • From the CPU, back onto the system bus, to the NIC.
  • I/O with the ram and disk, especially true if transcoding is being done.
  • From the NIC through the network which is composed of cabling, switching/routing nodes, and wireless access.
  • To the playback device which has its own system bus, CPU, memory and storage I/O, etc.
So with that said:
  • top -C -s 5 will show you if your CPU is maxing out, and will show if its the TVHeadend process that is the guilt culprit. It will also show you the system load during the last one, five, and fifteen minute periods. It will show you if your machine is starving for ram.
  • vmstat -w 5 will show you lots of stuff. First three columns are r b w. You can read online about those, but if you consistantly / frequently see a non-zero number in the 'b' column, then you have a system where process(es) are blocked for resources. Under disk you will see columns that show the amount of disk activity, page swapping, etc.
  • systat -ifstat 5 will show you traffic levels with your NIC. And your video session should be able to provide you with the traffic level (in Mbps); if these are approaching 75% of the max bandwidth of your wired network and / or wireless network you should be concerned.
  • systat -vmstat 5 will show you a bunch of stuff, including actual disk I/O in KB/transfer, tranfers/per-second, MB/s, and % busy.
  • Wifi sucks. In my house I can only run one or two video streams and at lower bitrates. I've been meaning to try and find out why and attempt to fix it, but no time to do so. Its not a simple case of signal strength and bandwidth. WiFi is much more complex than that. Using my wired network, which is currently 100Mbps, I have no issues.
  • It takes a lot of CPU to do transcoding (unless you have hardware based transcoding working). My old Intel Core2 6400 has no trouble doing multiple streams of videos directly from disk to playback device (meaning no transcoding), or even doing a single stream of light transcoding of a SD video. But as soon as I try to transcode a HD 1080p video that was recorded at +18Mbps stream rate in MPEGTS container my CPU hits zero. So I will soon buy a new box; most likely an AMD Ryzen 5 based 1600 machine. My design goal is 4 HD streams simultaneously. (4 playback, 3 playback + 1 record, 2 play back + 2 record) etc.

Give that a couple reads and then try to determine what is occurring in your set up.


Staff member

Thanks: 6,087
Messages: 26,977

Yeah, Wifi is pretty bad at my place too. Too many neighbors, too close together and everybody has Wifi these days. The whole 2.4GHz band is completely full, I only get fairly decent reception on 5GHz but not all my devices support it. That said, when the reception is fairly good I've found that 54Mbps (802.11g) is barely enough for 720p. On 802.11n I'm able to play full 1080p with DTS audio without any noticeable stuttering.