Use FILE_ATTRIBUTE_TEMPORARY and FILE_FLAG_DELETE_ON_CLOSE for time shift files (1 Viewer)

Andy_2639

Portal Member
February 25, 2017
25
6
Stuttgart
Home Country
Germany Germany
Started on: 2023-12-26
last update: 2023-12-26

Summary:
Minimize the amount of data written to disk by simulating a tempfs RAM disk on Windows via file open attributes
  • FILE_ATTRIBUTE_TEMPORARY
  • FILE_FLAG_DELETE_ON_CLOSE

Area:
TVServer

Description:
Time shift files are just used temporary. As they can take quite some space, virtual memory (im my case 16 GB RAM + 32 GB swapfile) is most likely to small. So they have to be written on disk (current situation). Windows can "simulate a RAM disk" by opening/creating the time shift files with the attributes
  • FILE_ATTRIBUTE_TEMPORARY
  • FILE_FLAG_DELETE_ON_CLOSE
Such files are written to disk only if necessary (Windows and its memory management take care of it).

The advantage is that the disk/SSD has less written data and thus less wear and less power consumption.

I don't know whether this flags are available from C#. I don't know how the flags behave when the file is opened multiple times (TVServer writing it and TVServer reading it (RTSP) or MediaPortal client reading it).


I don't know the MediaPortal source code, so usage of this flags might be already the case.
 

framug

Super Moderator
  • Team MediaPortal
  • January 31, 2005
    6,032
    2,118
    South of France
    Home Country
    France France
    Hello,
    Just another idea.
    Maybe, more interesting could be, in case of recording direct TV, to merge the TS buffer at the beggining of the recording.
    Not sure in this case that pushing timeshifting in RAM could continue to give this potential possibility...
     

    Users who are viewing this thread

    Top Bottom