L2ARC always mostly empty

Status
Not open for further replies.
Joined
Jun 17, 2013
Messages
36
I have a 30 GB SSD for an L2ARC. According to zpool status -v the drive always seems to have approximately 3.5 GB space used and the rest is free.

Shouldn't the cache drive be mostly full? Especially after running 10 VMs for months on end?

Thanks,

-A
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
zpool status -v shows utilization? I don't see that.

Why not try arc_summary.py and biduleohm's script arcstats.sh?
 
Joined
Jun 17, 2013
Messages
36
zpool status -v shows utilization? I don't see that.

Why not try arc_summary.py and biduleohm's script arcstats.sh?

Sorry--I meant 'zpool iostat -v'.

Hadn't seen 'arc_summary.py' before.

But I confess, I must be dyslexic. Combined with the horribly long drive names when GELI is involved, and most of the FreeBSD/ZFS commands column alignment issues, I totally had my allocated/free numbers backwards.

Code:
[root@nas1] ~# zpool iostat -v
                                           capacity     operations    bandwidth
pool                                    alloc   free   read  write   read  write
--------------------------------------  -----  -----  -----  -----  -----  -----
freenas-boot                            1.47G  28.3G      4      0  7.14K     79
  mirror                                1.47G  28.3G      4      0  7.14K     79
    ada0p2                                  -      -      2      0  4.29K     84
    ada1p2                                  -      -      1      0  5.90K     84
--------------------------------------  -----  -----  -----  -----  -----  -----
tank                               3.34T  3.91T    430    258  3.20M  1.98M
  raidz2                                3.34T  3.91T    430    258  3.20M  1.98M
    gptid/43346847-5ea0-11e2-8e25-002590a4a13d      -      -     49     35  1.51M  1.02M
    gptid/43540a57-5ea0-11e2-8e25-002590a4a13d      -      -     49     35  1.51M  1.02M
    gptid/43751897-5ea0-11e2-8e25-002590a4a13d      -      -     49     35  1.51M  1.02M
    gptid/43964292-5ea0-11e2-8e25-002590a4a13d      -      -     49     35  1.51M  1.02M
cache                                       -      -      -      -      -      -
  gptid/fb681a94-ef84-11e4-b05f-002590a4a13d  25.2G  4.62G     42     25   283K  2.92M
--------------------------------------  -----  -----  -----  -----  -----  -----


Looks right on target to me.

Sorry for the noise.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
I have a 30 GB SSD for an L2ARC. According to zpool status -v the drive always seems to have approximately 3.5 GB space used and the rest is free.

Shouldn't the cache drive be mostly full? Especially after running 10 VMs for months on end?

Thanks,

-A

Not necessarily. Getting an L2ARC to work properly requires all other aspects of the system to be properly resourced.

Here's just one small example. I don't know what your configuration is, so you'll have to decide if this applies to you or not:

Say you built a FreeNAS box with 8GB of RAM, then decided to put in an L2ARC. We'll say 30GB since that's your size (30GB of RAM is horribly oversized for your system, but go with it for now.. I'll explain in a bit).

Data must be read into RAM, then accessed enough times to meet the threshold for the L2ARC. I believe it has to be accessed 5 times. If it is not accessed 5 times before it is flagged for removal from the ARC, the L2ARC will not cache it at all. It is not even considered for the L2ARC. So because you under-resourced one aspect of your system (ARC) you've actually made the L2ARC mostly non-functional. This behavior, along with multiple others I won't go into detail on in this post, is just one of many reasons why we say you need lots of RAM before you consider an L2ARC. Not after. Not during some testing phase. Not because you can. Before and only before. Otherwise you'll buy that nice shiny SSD and it will provide you with no useful caching. (Keyword: useful).

Now why is oversizing the L2ARC bad? Back to our example.

So as the L2ARC starts filling with data the L2ARC index must be stored in RAM. So the more L2ARC you have, the less RAM you have for actual zpool data. This means that as you cache more info in the L2ARC you actually hurt the performance of the ARC. At some point the ARC begins to churn through data so quickly that you not only will never use the data even twice (so the L2ARC effectively becomes a read-only cache device), but the ARC is so small that performance of the zpool takes a nosedive.

Now to go in detail on the "keyword: useful" aspect of my comment.

People like you will read the data like you did, see that a couple of GB of data is in the L2ARC, and then make the conclusion that your L2ARC isn't oversized and is being used properly because it *is* storing information. So clearly this Cyberjock guy doesn't know what he is talking about because *I* just looked at my zpool info and I got ABC GB of data in the L2ARC. These numbers are accurate, but the conclusion is probably false. ZFS metadata is used so frequently it is trivially easy to end up with metadata in the L2ARC, even on an under-resourced system. Seems like a win-win, but it's not. Metadata is often composed of smaller blocks. Since the L2ARC index stores its entries per block, the best scenario is to cache blocks that are as big as possible. Having 300 bytes of RAM cache 128KB of data in the L2ARC is better than having 300 bytes of RAM cache 512 bytes of data in the L2ARC. ZFS normally allocates a percentage of the ARC for metadata and a percentage for file data (typically 25%/75% if I remember correctly). You'll break this relationship because L2ARC index counts as metadata, even if the index entry points to zpool file data. Can you try to fix this relationship yourself with tuning. Sure can, but that doesn't fix other aspects of ZFS.

Now there is also a performance penalty with retrieving data from the L2ARC. After all, SATA/SAS isn't nearly as fast as RAM. Even PCIe isn't as fast as RAM in terms of latency and throughput. But L2ARCs are useful because, despite the fact that they are slower than your RAM, they are almost certainly faster than your zpool. But, because of all of the other aspects of how ZFS works, this performance gain from an L2ARC can be more than offset by the starved ARC, which can (and is documented plenty of times in the forum by various users that argued that they knew better) hurt the zpool's overall performance.

When it comes to ZFS, L2ARCs and slogs, the flowchart is not simple. It would look something like this...

flowchart.jpg


Unless you are about to dive into ZFS and have the knowledge to create the flowchart yourself, you're stuck listening to the somewhat generalized experience of this forum. For this reason, the obvious answer to 99.9% of people's questions is to just blindly do what we recommend around here. Unfortunately a large percentage ignore that and do what they want because they think they know better. They don't, and they are simply throwing money and performance away when they don't want to listen. Sad, but also true.

So what do I know about your system based on just this one example and the output you provided? Since you have 2GB used in your L2ARC on a system with VMs that would make me question your system's resources. I'd almost bet money you don't have at least 64GB of RAM, and probably have 16GB or less, and as a result you have unknowingly broke the design of the L2ARC thereby making it somewhat useless. :P

There are, of course, exceptions. Some setups will not have a lot of data in the L2ARC because of what the VM itself does internally. If you run a SQL database in a VM and SQL is configured to cache the whole database in RAM (or at least the vast majority of the database that is used) you may find very little data is being read multiple times, so the L2ARC won't get much data put into it. So yes, there are exceptions. But what's the chances of every one of your VMs behaves in exactly this manner? Pretty darn close to zero. If you were that level of 'pro' with this stuff you wouldn't be going to a forum to get assistance, you'd be the one writing the guides and manual edits. ;)

See, when I ask for a debug file, that thing gives me massive amounts of information on a person's system. More than they realize. It is generally super-easy to figure out if someone tried to properly resource their system or is being a selfish jerk and deliberately ignored our recommendations and now expect us to help them tune ZFS for their system. Guess which group of people ends up on my ignore list quickly? ;) I don't have time for people that try to hide the fact that they're being selfish and won't at least try to make things work for themself before asking someone to help them out.. for free.

I have no pity or respect for those that ignore our recommendations and cry because they can't hit some performance metric that matters to them.

I'm not saying you are ignoring our recommendations or anything. I don't know. You also aren't crying because your performance is poor. You are just curious as to how this stuff all works. Hopefully now you understand that, with just the one small example I gave, that ZFS is far far more complex than most people realize and can't be taken lightly. Just looking at a couple of numbers won't tell you good or bad things, it's a lot of numbers and what the workflow of ZFS is doing based on those numbers. ;)
 
Joined
Jun 17, 2013
Messages
36
So clearly this Cyberjock guy doesn't know what he is talking

LMAO!

I suspect during the day you are a mild-mannered forum poster named cyberjock, but at night you go by the name Jeff Bonwick and design filesystems. ;)

So what do I know about your system based on just this one example and the output you provided? Since you have 2GB used in your L2ARC on a system with VMs that would make me question your system's resources. I'd almost bet money you don't have at least 64GB of RAM, and probably have 16GB or less, and as a result you have unknowingly broke the design of the L2ARC thereby making it somewhat useless. :p

Sorry. My example was bad. I had to confess here that I misread the alloc/free columns because of the bad tab alignment/stroke/dyslexia/aliens, etc...
But the system has 32G RAM. Most of the boxes we are deploying now have 64 GB because we're secretly hoping there might be some sort of virtualization available directly in FreeNAS... ;)

The only system I run under-spec is my home storage server with ~10 TB storage across 14 drives with 4 GB of mismatched memory. It's a total frankenbox, but the surprising part is that it *never* crashes. The only reason I'm not over 1.5 years of uptime was a really bad winter storm that knocked out power for ~9 hours. ;)

So clearly this Cyberjock guy doesn't know what he is talking
I'm not saying you are ignoring our recommendations or anything. I don't know. You also aren't crying because your performance is poor. You are just curious as to how this stuff all works. Hopefully now you understand that, with just the one small example I gave, that ZFS is far far more complex than most people realize and can't be taken lightly. Just looking at a couple of numbers won't tell you good or bad things, it's a lot of numbers and what the workflow of ZFS is doing based on those numbers. ;)[/QUOTE]

I appreciate the info as always.

Thanks,

-A
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Cool that you got the columns mixed up. But now I can share another tidbit based on the zpool iostat -v you provided. :)

See that you had 283KB read and 2.92MB written? If you are churning through the L2ARC too quickly (this depends on various factors, but the default of 8MB/sec is the cap for adding data to the L2ARC after it has reached 80% full) then your L2ARC may be under-sized for the workload. A good L2ARC shouldn't need significant amounts of writes. In fact, the fact that the drive is writing hurts the L2ARCs performance as the ZFS scheduler has to make time to write the data. ;)

Yes, it says that 4GB are free in the L2ARC, but that's pretty common. There's a certain amount of backpressure involved with an L2ARC that is nearly full, so seeing an L2ARC that is 95%+ full is very rare.
 
Status
Not open for further replies.
Top