Forums » Tutorial and setups »
Fit to RAM (cut rewind)
Added by Ash Guest over 7 years ago
Hi i'm using HTS Tvheadend 4.1-2405 and under Timeshft tab i have:
Fit to RAM (cut rewind) with the help text of "If possible, maintain the timeshift data in the server memory only. This may reduce the amount of allowed rewind time."
What the difference between the above setting and the "RAM Only" setting, i want the time shift on RAM rather than using my SSD... so i have selected RAM only, but i'm not sure i fully understand what FIT to RAM does??? i have it checked anyway!
Replies (10)
RE: Fit to RAM (cut rewind) - Added by Mark Clarkstone over 7 years ago
Ash Guest wrote:
Hi i'm using HTS Tvheadend 4.1-2405 and under Timeshft tab i have:
Fit to RAM (cut rewind) with the help text of "If possible, maintain the timeshift data in the server memory only. This may reduce the amount of allowed rewind time."
What the difference between the above setting and the "RAM Only" setting, i want the time shift on RAM rather than using my SSD... so i have selected RAM only, but i'm not sure i fully understand what FIT to RAM does??? i have it checked anyway!
I had a look into this as I thought you raised a good question. Going from the commit commit:3b59d92534edf7ddaca34d0d2ebdefa9ae8ecaee it's to reduce the disk read/write when timeshift is used with a hard drive.
Basically the fill the allowed RAM before writing to the drive & only when RAM is full place the buffer on the drive as a last resort, rinse repeat.
I'll try and reword it in the docs.
RE: Fit to RAM (cut rewind) - Added by Ash Guest over 7 years ago
Thanks Mark,
so that i'm clear and i fully understand!
with RAM Only checked & Fit to RAM not checked = Buffer will fill RAM up to the amount that is entered in the "Maximum RAM size" field, once this value is reached, the buffer is transferred to disk (presumably the default location if nothing is stated in "storage path") although if "Maximum Time Period" is reached then the buffer will cycle on the RAM.
With RAM Only checked & Fit to RAM Checked = Buffer is always kept on RAM and never transferred to disk meaning that the buffer will cycle if either the "Maximum RAM size" is reached or the "Maximum Time Period" is reached.
Presumably FIT to RAM is null and void if RAM Only is not checked?
RE: Fit to RAM (cut rewind) - Added by Jaroslav Kysela over 7 years ago
Fit to RAM is just a special case of RAM only, if the Maximum RAM size (MB) is nonzero. If RAM is full, the first chunk of data is removed before a new chunk allocation. It might make sense to replace two booleans with a tri-state combobox or so.. Or parhaps, there should be operational mode list:
Disk only RAM + disk RAM circular (currently 'RAM fit'), or maybe you find a better name (RAM latest, RAM remove oldest or so...). RAM
RE: Fit to RAM (cut rewind) - Added by Mark Clarkstone over 7 years ago
Jaroslav Kysela wrote:
Fit to RAM is just a special case of RAM only, if the Maximum RAM size (MB) is nonzero. If RAM is full, the first chunk of data is removed before a new chunk allocation. It might make sense to replace two booleans with a tri-state combobox or so.. Or parhaps, there should be operational mode list:
[...]
Thanks ever so much for taking the time to clear that up (I know you're really busy right now). So, as per usual, I was totally off the mark, heh!
RE: Fit to RAM (cut rewind) - Added by Ash Guest over 7 years ago
thanks both for your help... great work by the way...
RE: Fit to RAM (cut rewind) - Added by Antonio Tex over 7 years ago
Good morning everyone!
I'm also trying to understand tvheadend's timeshift and when i 've thought to discover how to using it i get some strange results that i cannot explain.
I've tested it and these are my results: let's suppose i've set maximum ram size=128MiB Fit to ram=on Maximum period=30*if one client start to watching a channel everything is working as expected so the client can rewind as long there is data in the circular buffer: if he rewinds or if click pause and the circular buffer become full tvheadend start to write data also to disk like it should be because user request this with an explicit action. With the same initial situation above if a second client connects, maximum ram size is shared among the 2 clients and again if one of them press pause or rewind for the fist time tvheadend start writing to disk as soon circular buffer for that user is full. This works for n clients where n it's not clear for me because in my case if a third client connects tvheadend start to write data to disk as soon the third client connects (i supposed (and agreed) it's normal as 128 MiB of maximum ram can't be shared over a huge number of client). Now, if i add one more limit with the three above that is *maximum size=512MiB i expected that if one client press pause or rewind (or a third client connect in my case) and tvheadend start to write to disk the maximum size of data written will be 512MiB. Am i wrong? Because i can see that the size on disk grows without a limit. What does maximum size option do? It seems to work if i set it to 0: no timeshit available in this case, but if i set it to another value like 1 and a client press pause data grows in memory and then in disk uncontrolled. If I set also a maximum period of one minute data grows uncontrolled (and period also). Is there a way to limit data on disk?
Thanks if someone has time to explain me and thanks @perexg for your wonderful work.
RE: Fit to RAM (cut rewind) - Added by Mark Clarkstone over 7 years ago
Antonio Tex wrote:
Good morning everyone!
I'm also trying to understand tvheadend's timeshift and when i 've thought to discover how to using it i get some strange results that i cannot explain.
I've tested it and these are my results: let's suppose i've set maximum ram size=128MiB Fit to ram=on Maximum period=30*if one client start to watching a channel everything is working as expected so the client can rewind as long there is data in the circular buffer: if he rewinds or if click pause and the circular buffer become full tvheadend start to write data also to disk like it should be because user request this with an explicit action. With the same initial situation above if a second client connects, maximum ram size is shared among the 2 clients and again if one of them press pause or rewind for the fist time tvheadend start writing to disk as soon circular buffer for that user is full. This works for n clients where n it's not clear for me because in my case if a third client connects tvheadend start to write data to disk as soon the third client connects (i supposed (and agreed) it's normal as 128 MiB of maximum ram can't be shared over a huge number of client). Now, if i add one more limit with the three above that is *maximum size=512MiB i expected that if one client press pause or rewind (or a third client connect in my case) and tvheadend start to write to disk the maximum size of data written will be 512MiB.
Am i wrong? Because i can see that the size on disk grows without a limit. What does maximum size option do? It seems to work if i set it to 0: no timeshit available in this case, but if i set it to another value like 1 and a client press pause data grows in memory and then in disk uncontrolled. If I set also a maximum period of one minute data grows uncontrolled (and period also). Is there a way to limit data on disk?
Thanks if someone has time to explain me and thanks @perexg for your wonderful work.
As perexg says above..
Fit to RAM is just a special case of RAM only
which means without "RAM Only" enabled it won't actually cycle the timeshift buffers, just overwrite them when full.
RE: Fit to RAM (cut rewind) - Added by Antonio Tex over 7 years ago
Hello Mark, thanks for your answer.
So now you are saying that it should be with "Maximum ram size" non zero: With "Ram only" and "fit to ram" deactivated if one client connects ram is filled first and then, after reaching maximum ram size limit specificated, tvheadend start to buffer on HD; with "Ram only" on and "fit to ram" deactivated tvh grows ram buffer and when it's full it overwrites the buffer completely ; with "Ram only" on and "fit to ram" on tvh grows ram buffer and when it's full instead of overwriting the buffer completely it cuts the oldest data.
But i've interpreted @perexg answer in a different way also according to my test the third option seems to work despite not switching on "Ram Only" but turning on only "fit to ram": in fact as i reported if one client connects with "Fit to ram =1" and "ram only=0" tvh doesn't write anything to disk unless i press "pause" (and this is good because if a client press pause he might want that buffer goes up to the certainly minor quantity of "ram maximum size") so it circularly overwrite ram buffer (until as said a user press pause and here is the difference beethween ram only =1 + fit to ram=1 together that is ,with both on, tvh won't write anything even if a user press pause so with "ram only=1 + fit to ram=1" disk writing is completely disabled ). But i don't consider it a problem or a bug because i found it clever (to have the above behavior when only "fit to ram" is on): if a user press pause we go over the limited circular timebuffer by writing to disk.
Now focusing to the other "question" and for me there must be something wrong regarding "maximum size" and "time" limit that tvh seems not to respect or to be precise: "maximum period time" is respected but for example if i set one minute, minutes for real are 3-4 (not a problem honestly) but "maximum size" seems to be completely ignored (here: https://goo.gl/photos/XPwgxcdz5pHoSAPv7 an example) bug?
Thanks this time i hope to be as clear as possibile sorry if not
EDIT: changed some words to be more precise
RE: Fit to RAM (cut rewind) - Added by Mark Clarkstone over 7 years ago
Antonio Tex wrote:
Hello Mark, thanks for your answer.
So now you are saying that it should be with "Maximum ram size" non zero: With "Ram only" and "fit to ram" deactivated if one client connects ram is filled first and then, after reaching maximum ram size limit specificated, tvheadend start to buffer on HD; with "Ram only" on and "fit to ram" deactivated tvh grows ram buffer and when it's full it overwrites the buffer completely ; with "Ram only" on and "fit to ram" on tvh grows ram buffer and when it's full instead of overwriting the buffer completely it cuts the oldest data.
But i've interpreted @perexg answer in a different way also according to my test the third option seems to work despite not switching on "Ram Only" but turning on only "fit to ram": in fact as i reported if one client connects with "Fit to ram =1" and "ram only=0" tvh doesn't write anything to disk unless i press "pause" (and this is good because if a client press pause he might want that buffer goes up to the certainly minor quantity of "ram maximum size") so it circularly overwrite ram buffer (until as said a user press pause and here is the difference beethween ram only =1 + fit to ram=1 together that is ,with both on, tvh won't write anything even if a user press pause so with "ram only=1 + fit to ram=1" disk writing is completely disabled ). But i don't consider it a problem or a bug because i found it clever (to have the above behavior when only "fit to ram" is on): if a user press pause we go over the limited circular timebuffer by writing to disk.
Now focusing to the other "question" and for me there must be something wrong regarding "maximum size" and "time" limit that tvh seems not to respect or to be precise: "maximum period time" is respected but for example if i set one minute, minutes for real are 3-4 (not a problem honestly) but "maximum size" seems to be completely ignored (here: https://goo.gl/photos/XPwgxcdz5pHoSAPv7 an example) bug?
Thanks this time i hope to be as clear as possibile sorry if not
EDIT: changed some words to be more precise
Your post is very hard to read. Spacing helps
Ok, Going from your screenshot..
You have "Unlimited time" enabled, which means Tvheadend won't limit the amount of time or storage used, so it won't matter what values you set for "Maximum period" and "Maximum size", it ignores them.
RE: Fit to RAM (cut rewind) - Added by Antonio Tex over 7 years ago
Hello Mark, thank for your explanation.
Now i understand
Sorry about my complicated post.
Have a nice day