Jump to content

Read caching


Recommended Posts

Hey,

 

I just setup an Unraid server which is mainly going to be used for running VMs. I would like to have fast access to each VM's vdisk. I also have some data which I need fast access to. Of course I would also like to have this data parity protected. How do I do this with Unraid? As I understand adding a cache drive will only improve my write speed (assuming I have the share set to "prefer"). So what I would like to have is a cache pool which is periodically backed up on the array. Does this exist in Unraid? Is there another way of achieving what I want? Note, I know I could add a second cache drive and set it to raid 1 but this seems wasteful since I already have an array which is parity protected.

 

Best,
Michael

Link to comment
2 hours ago, MichaelBernasconi said:

Of course I would also like to have this data parity protected. How do I do this with Unraid?

I am not an expert in this area but this need for speed with parity protection is exactly why the cache pool was incorporated into Unraid.  Look into those various setup options for the cache pool. 

 

About backing up the cache drive.  There is a plugin called CA Backup (Part of the CA (Community Applications) package) that might be configurable to do the job. 

 

There is also a plugin called User Scripts which will periodically run a BASH script that could do the task of backing up the Cache drive. 

 

You indicate that you are new, so let me suggest that you install the Community Applications plugin if you have not already done so.  You can find more info here:

 

    https://forums.unraid.net/topic/38582-plug-in-community-applications/

 

I have forgotten what all of the CA apps are installed with the initial install link but it definitely includes the APPS package which is the app store for Unraid.

 

Link to comment

Thank you for the quick reply. About the cache pool. As I understand it it's main objective is increasing the perceived write speed. This is done by first writing data to the fast cache drive and then later moving the data to the array. My problem with this solution is that the mover actually removes the data from the cache drive. As far as I understand there is no option for the mover to keep the data on the cache drive and the array at the same time. Is this correct or did I miss something?

 

I will take a look at CA Backup to see if it can do what I want.

 

Best,

Michael

Link to comment
2 hours ago, MichaelBernasconi said:

As far as I understand there is no option for the mover to keep the data on the cache drive and the array at the same time. Is this correct or did I miss something?

You are missing something. Take a look at the various cache settings:

 

The FAQ in general has a lot of useful info:

 

https://forums.unraid.net/topic/46802-faq-for-unraid-v6/

 

Note that Unraid creates a default share "appdata", which is the default place VMs and Dockers live. Its cache setting is by default "Prefer".

 

I also recommend you give SpaceInvaderOne's Unraid Basics tutorial series a look for a lot of good info on how to get the most out of Unraid:

 

https://www.youtube.com/playlist?list=PL6MCtOroZNDCXhQQWrVjbPWO-45qV7SOF

 

Edited by Phoenix Down
Link to comment

I took another look at the description in the Unraid gui and i also watched SpaceInvaderOne's video about cache. Either I am really missing something here or we are not talking about the same thing. What I would like to have is a share which is stored on the cache AND the array. I want the data to be on the cache drive at all times for the read speed and I want it to be on the array for the parity protection. The available cache settings are the following.

 

Quote

No prohibits new files and subdirectories from being written onto the Cache disk/pool.
Mover will take no action so any existing files for this share that are on the cache are left there.

This one is clearly not what I want. The cache drive will be ignored.

 

Quote

Yes indicates that all new files and subdirectories should be written to the Cache disk/pool, provided enough free space exists on the Cache disk/pool.
If there is insufficient space on the Cache disk/pool, then new files and directories are created on the array.
When the mover is invoked, files and subdirectories are transferred off the Cache disk/pool and onto the array.

This is also not what I want because when the mover is invoked, files and subdirectories are transferred off the Cache drive. This means they will no longer be on the cache drive, right?

 

Quote

 

Only indicates that all new files and subdirectories must be writen to the Cache disk/pool.
If there is insufficient free space on the Cache disk/pool, create operations will fail with out of space status.

Mover will take no action so any existing files for this share that are on the array are left there.

 

This would give me the read speeds I want as the data is always on the cache drive but it would never be written to the array. So it is also not quite what I want.

 

Quote

Prefer indicates that all new files and subdirectories should be written to the Cache disk/pool, provided enough free space exists on the Cache disk/pool.
If there is insufficient space on the Cache disk/pool, then new files and directories are created on the array.
When the mover is invoked, files and subdirectories are transferred off the array and onto the Cache disk/pool.

This is basically the same as Yes but it does not complain when the cache is full. So the files are still transferred off the cache drive to the array when the mover is invoked.

 

 

So my question remains. How do I make a share that is both on the cache AND the array? Essentially I would like something like the Yes setting but the mover does not remove the data from the cache drive. I realize that I could set my share to Only and have a script periodically backup the share to the array. However, this would not allow Unraid to automatically use the share on the array in case the cache drive fails. 

 

Best,

Michael

Link to comment
1 hour ago, MichaelBernasconi said:

So my question remains. How do I make a share that is both on the cache AND the array? Essentially I would like something like the Yes setting but the mover does not remove the data from the cache drive. I realize that I could set my share to Only and have a script periodically backup the share to the array. However, this would not allow Unraid to automatically use the share on the array in case the cache drive fails.

A file can only be in one place at one time. It's either on a disk in the array, or it's in the cache. It cannot be in two places at the same time.

 

You are right about a single cache drive potentially failing and taking your data with it. That's why Unraid allows you to use more than 1 disk to create a cache pool. I run 2x 1TB NVMe SSDs in btrfs RAID1 for redundancy protection for my cache pool.

 

With that said, regardless of your cache configuration, you can also consider the CA Appdata Backup / Restore app to automatically backup your appdata share, where you Dockers and VMs live:

 

 

You will need the Community Applications plugin to get started. It basically gives you access to an app store of community developed apps that basically everyone uses. I encourage you to watch more of SpaceInvaderOne's Unraid Basics tutorial videos. He goes over this in the 2nd video and recommends some popular apps (CA Appdata Backup / Restore among them).

Edited by Phoenix Down
Link to comment

Thanks! I will try to setup some kind of backup process to my cache drive.

Just out of curiosity. Is there a reason why the kind of caching I described is not a standard feature of Unraid? To me it seems that having fast read access to data while at the same time having a secure copy of it on the array would be something many people are interested in. I understand that adding a second cache drive for redundancy kind of does the same thing but it seems very expensive and unnecessary given that the array already exists. Another advantage would be that in case of a cache drive failure Unraid could just continue using the (slow) data on the array until the cache drive is replaced. This way the data would not have to be restored manually from some kind of backup. 

Link to comment
6 hours ago, MichaelBernasconi said:

Thanks! I will try to setup some kind of backup process to my cache drive.

Just out of curiosity. Is there a reason why the kind of caching I described is not a standard feature of Unraid? To me it seems that having fast read access to data while at the same time having a secure copy of it on the array would be something many people are interested in. I understand that adding a second cache drive for redundancy kind of does the same thing but it seems very expensive and unnecessary given that the array already exists. Another advantage would be that in case of a cache drive failure Unraid could just continue using the (slow) data on the array until the cache drive is replaced. This way the data would not have to be restored manually from some kind of backup. 

There is a Feature Request forum for just that :)

https://forums.unraid.net/forum/53-feature-requests/

 

I'm asked for read cache as well, but more as an intelligent tiering system (i.e. most frequently read data is automatically cached in the cache pool for fast reads, the stale data is evicted from cache). The CEO of LimeTech did hint that they are thinking along those lines. This is from an interview from last year:

 

https://unraid.net/blog/unraid-14th-birthday-blog

 

Quote

I want to build in more intelligence to the ‘mover’ to auto-promote share data based on usage and storage device characteristics available to a server (or group of servers).

 

Link to comment
  • 3 years later...
On 6/9/2020 at 10:42 AM, MichaelBernasconi said:

Cool! Thanks! Intelligent caching would for sure be a very cool addition to Unraid.

I'm looking for a web caching app and stumbled upon this during a google search. I feel like you got bad advice. I think you can definitely have it in two places, provided you have the use case and it makes sense - for you to determine. One way I can think of immediately, is by having a share on a cache pool that isnt interacting with the array, and have some sort of cron job/rsync setup to effectively 'back up' to the location of duplication

Edited by erlipton
to edit
Link to comment
2 minutes ago, erlipton said:

I feel like you got bad advice. I think you can definitely have it in two places, provided you have the use case and it makes sense - for you to determine.

Although it is possible to have a second copy of a file if you manually make copies to a different drive, Unraid will not be aware of this and will only present one copy to the user.  If the drive holding that copy drops offline then Unraid will transparently revert to using the other copy even if it’s contents might be completely different with no warning this is taking place.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...