Wake the DVR drive when the user is browsing recordings

I just moved my DVR storage from my Mac Mini's internal fusion drive to a USB hard drive.

This USB drive (an 8TB WD Elements) automatically spins down when it's inactive, and it takes about 10 seconds to spin back up. This creates a long, mildly annoying delay when viewing a stored recording if the drive is cold.

It would be nice if the Channels app could tell the DVR server to attempt to wake the drive when I go into "Recordings" (or maybe even when I open the app?), so that it's ready to go by the time I start playing something.

This also seems like it could be a potential issue with recording.

I just saw this in my DVR log. It looks like the recording buffer got halfway full while the WD Elements drive was spinning up (and seemed to take a little longer than usual to do so... it looks like it took 19 seconds before the DVR was able to start writing the video to disk):

2019/02/20 15:00:00 [DVR] Starting job 1550703600-7 PBS NewsHour on ch=[1009]
2019/02/20 15:00:00 [DVR] Waiting 2h59m59.650055s until next job 1550714400-30 ABC7 News 6:00PM
2019/02/20 15:00:00 [TNR] Opened connection to 13220A82 for ch1009
2019/02/20 15:00:18 [WRN] Buffer for 13220A82 ch1009 is more than 50% full (clients=1, len=16777684)
2019/02/20 15:00:19 [DVR] Recording for job 1550703600-7 from 13220A82 ch1009 into "TV/PBS NewsHour/PBS NewsHour S45E168 2019-02-20 2019-02-20-1500.mpg" for 59m59.650005s

KQED compresses their MPEG-2 video more than most OTA stations do (they have a HD subchannel), but this could be a problem if I was recording a higher-bitrate station.

Edit: In fact, looking further back in my DVR logs, it looks like the buffer has gotten 75% full while recording KNTV:

2019/02/19 00:37:00 [TNR] Opened connection to 13220A82 for ch1011
2019/02/19 00:37:13 [WRN] Buffer for 13220A82 ch1011 is more than 50% full (clients=1, len=16777684)
2019/02/19 00:37:18 [WRN] Buffer for 13220A82 ch1011 is more than 75% full (clients=1, len=25165868)
2019/02/19 00:37:19 [DVR] Recording for job 1550565420-1 from 13220A82 ch1011 into "TV/Late Night With Seth Meyers/Late Night With Seth Meyers S06E65 2019-02-18 John Oliver Tatiana Maslany St Paul and The Broken Bones Jeff Friedl 2019-02-19-0037.mpg" for 1h0m59.717373s

Seems like this could be mitigated by trying to spin up the drive a minute or so before recording (or by expanding the memory buffer size on DVR servers that have a lot of RAM).

The buffer is there in place precisely for this reason, and 75% full isn't that bad. There are 95% and 99% thresholds which are more worrisome if you hit them.

I agree some kind of drive wakeup could be useful, but its hard to know what the right balance is. I certainly use the app for live tv a lot of times and don't want unnecessary wakeups, and there are also times where I launch a recording playback via the Top Shelf and there's no chance for a wakeup to occur.

I definitely overflow the buffer waiting for my WD My Book Duo to spin up. (It may be only when two or more shows start to record at the same time; but such a situation is not unusual.)

I’ve addressed it by starting recordings 1 minute before (from my previous 30s before setting).

It would be nice to have a bigger buffer (or an option to specify a bigger buffer). I’ve got a lot of unused RAM.

OS

Intel NUC7i5BNK
Linux Debian
9.7 (kernel: 4.9.0-8-amd64)

CPU

4 cores / Intel(R) Core(TM) i5-7260U CPU @ 2.20GHz

load averages: 0.02 0.01 0.00

RAM

15.57 GB
94.2% free

I definitely overflow the buffer waiting for my WD My Book Duo to spin up. (It may be only when two or more shows start to record at the same time; but such a situation is not unusual.)

I’ve addressed it by starting recordings 1 minute before (from my previous 30s before setting).

It's actually reassuring to know that Channels uses a circular buffer here. I had assumed the DVR would simply cancel the recording or crash if the buffer overflows... now @tmm1's sanguineness about a 75% full buffer makes much more sense!

Looking at the log, I see instances where it happens with just one recording starting:

2019/02/03 22:49:44 [DVR] Deleting /media/usb/ChannelsDvrRecordings/TV/The Late Show With Stephen Colbert/The Late Show With Stephen Colbert S04E86 2019-01-25 John Goodman Samantha Ruddy 2019-01-25-2334.mpg
2019/02/04 02:29:00 [DVR] Starting job 1549276140-17 Face the Nation on ch=[5.1]
2019/02/04 02:29:00 [DVR] Waiting 12h29m59.992603672s until next job 1549321140-8 PBS NewsHour
2019/02/04 02:29:00 [TNR] Opened connection to 10710F00 for ch5.1
2019/02/04 02:29:09 [WRN] Buffer for 10710F00 ch5.1 is more than 50% full (clients=1, len=16777816)
2019/02/04 02:29:13 [WRN] Buffer for 10710F00 ch5.1 is more than 75% full (clients=1, len=25166000)
2019/02/04 02:29:17 [WRN] Buffer for 10710F00 ch5.1 is more than 95% full (clients=1, len=31877600)
2019/02/04 02:29:17 [WRN] Buffer for 10710F00 ch5.1 is more than 99% full (clients=1, len=33219788)
2019/02/04 02:29:21 [DVR] Recording for job 1549276140-17 from 10710F00 ch5.1 into "TV/Face the Nation/Face the Nation 2019-02-03 2019-02-04-0229.mpg" for 1h1m59.992589257s
2019/02/04 03:31:00 [TNR] Closed connection to 10710F00 for ch5.1
2019/02/04 03:31:00 [DVR] Finished job 1549276140-17 Face the Nation
2019/02/04 03:31:00 [DVR] Waiting 11h27m59.533481815s until next job 1549321140-8 PBS NewsHour

1 Like