Skip to contentSkip to conversation

dm-cache caching network volume

DISCUSSION Étienne BERSAC 4 participants 5 messages Jun 18, 2013 – Sep 9, 2014 Device mapper

lore
Share & tools
lore
#0 lore raw

Hi,

I'm testing dm-cache for using a local SSD as a cache for a network volume. My goal is to test dm-cache behaviour when network is down.

The device is shared through iSCSI. The first test is filling a huge file with dd from /dev/zero. So, this is sequential access. While dd is running, i remove the tun iface from the bridge on the host. iSCSI properly detects the network failure.

I expected dm-cache to continue filling dirty blocks, even if the network device is blocking. But it doesn't. The status shows that dirty blocks count stays the same. dd is blocking.

I'm wondering if there is some cache desactivation due to sequential_threshold. But increasing sequential_threshold did not help. Where does dm-cache blocks ?

Is it possible to have dm-cache "bufferize" blocks for network failures ?

Regards,

Signature · 2 lines
Étienne BERSAC <[email protected]>
NON STOP Systems
#1 lore raw
Quoted 14 lines · Étienne BERSAC

Hi,

I'm testing dm-cache for using a local SSD as a cache for a network volume. My goal is to test dm-cache behaviour when network is down.

The device is shared through iSCSI. The first test is filling a huge file with dd from /dev/zero. So, this is sequential access. While dd is running, i remove the tun iface from the bridge on the host. iSCSI properly detects the network failure.

I expected dm-cache to continue filling dirty blocks, even if the network device is blocking. But it doesn't. The status shows that dirty blocks count stays the same. dd is blocking.

Quoted 8 lines

I'm wondering if there is some cache desactivation due to sequential_threshold. But increasing sequential_threshold did not help. Where does dm-cache blocks ?

Is it possible to have dm-cache "bufferize" blocks for network failures ?

Regards,

Disclaimer: Not an expert, and not actually involved in writing bcache

Well, since you didn't mention changing it, I suspect you are operating in the default "writethrough" mode - this doesn't return to userspace until the data is on the backing (iSCSI in your case) device. For bcache over a network volume, this is the safe option, since the client machine dying won't lose data.

If you put bcache in writethrough mode, it may well do exactly as you describe, but only if iSCSI itself recovers from the connection loss (and possibly other caveats I'm not thinking of). If it doesn't, or if it does but doesn't manage to maintain the exact state it was in on disconnection, then you will lose data.

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

#2 lore raw
Quoted 33 lines · Alex Elsayed
Quoted 14 lines · Étienne BERSAC

Hi,

I'm testing dm-cache for using a local SSD as a cache for a network volume. My goal is to test dm-cache behaviour when network is down.

The device is shared through iSCSI. The first test is filling a huge file with dd from /dev/zero. So, this is sequential access. While dd is running, i remove the tun iface from the bridge on the host. iSCSI properly detects the network failure.

I expected dm-cache to continue filling dirty blocks, even if the network device is blocking. But it doesn't. The status shows that dirty blocks count stays the same. dd is blocking.

Quoted 8 lines

I'm wondering if there is some cache desactivation due to sequential_threshold. But increasing sequential_threshold did not help. Where does dm-cache blocks ?

Is it possible to have dm-cache "bufferize" blocks for network failures ?

Regards,

Disclaimer: Not an expert, and not actually involved in writing bcache

Well, since you didn't mention changing it, I suspect you are operating in the default "writethrough" mode - this doesn't return to userspace until the data is on the backing (iSCSI in your case) device. For bcache over a network volume, this is the safe option, since the client machine dying won't lose data.

Quoted 5 lines

If you put bcache in writethrough mode, it may well do exactly as you describe, but only if iSCSI itself recovers from the connection loss (and possibly other caveats I'm not thinking of). If it doesn't, or if it does but doesn't manage to maintain the exact state it was in on disconnection, then you will lose data.

My apologies, I didn't realize until I ready my own reply on the way back that this was on the topic of dm-cache rather than bcache.

To properly respond, as I understand it dm-cache works by migrating chunks between the backing device and the faster cache. If your write would go to the backing device, it would block exactly as normal.

(I hope I didn't get this egregiously wrong...)

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

#3 lore raw
Quoted 18 lines · Alex Elsayed
Quoted 16 lines · Alex Elsayed
Quoted 14 lines · Étienne BERSAC

Hi,

I'm testing dm-cache for using a local SSD as a cache for a network volume. My goal is to test dm-cache behaviour when network is down.

The device is shared through iSCSI. The first test is filling a huge file with dd from /dev/zero. So, this is sequential access. While dd is running, i remove the tun iface from the bridge on the host. iSCSI properly detects the network failure.

I expected dm-cache to continue filling dirty blocks, even if the network device is blocking. But it doesn't. The status shows that dirty blocks count stays the same. dd is blocking.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I'm wondering if there is some cache desactivation due to sequential_threshold. But increasing sequential_threshold did not help. Where does dm-cache blocks ?

Is it possible to have dm-cache "bufferize" blocks for network failures ?

I'm a user, not the author, but here's what I've experienced with dmcache:

Huge sequential writes will generally bypass the cache; what is your setting for sequential_threshold? (Your message hints that it might actually be high enough.)

Second, even if it /is/ caching the blocks, I think the default mode is writethrough mode, which means that the write request waits first for ssd commit and then for origin device commit.

As for 'bufferizing' blocks ... in 3.9 (3.10?) writeback mode seems to write blocks to the ssd while issuing an asynchronous write to the origin device.

(Maybe you're already using wb mode?)

Quoted 17 lines
Quoted 11 lines
Quoted 2 lines

Regards,

Disclaimer: Not an expert, and not actually involved in writing bcache

Well, since you didn't mention changing it, I suspect you are operating in the default "writethrough" mode - this doesn't return to userspace until the data is on the backing (iSCSI in your case) device. For bcache over a network volume, this is the safe option, since the client machine dying won't lose data.

Quoted 5 lines

If you put bcache in writethrough mode, it may well do exactly as you describe, but only if iSCSI itself recovers from the connection loss (and possibly other caveats I'm not thinking of). If it doesn't, or if it does but doesn't manage to maintain the exact state it was in on disconnection, then you will lose data.

Quoted 6 lines

My apologies, I didn't realize until I ready my own reply on the way back that this was on the topic of dm-cache rather than bcache.

To properly respond, as I understand it dm-cache works by migrating chunks between the backing device and the faster cache. If your write would go to the backing device, it would block exactly as normal.

dmcache's default controller manages hot blocks...

--D

Quoted 8 lines

(I hope I didn't get this egregiously wrong...)

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

#4 lore raw
In reply to Étienne BERSAC
Quoted 2 lines · Étienne BERSAC

Is it possible to have dm-cache "bufferize" blocks for network failures ?

dm-cache is a slow moving cache, foor instance, it does not attempt to pass all writes through the SSD. Since you cannot rule out IO going to the origin device it's not suitable for adding resilience to an intermittent network connection. Perhaps you should look at dm-raid?

- Joe