Skip to contentSkip to conversation

Ceph on just two nodes being clients - reasonable?

DISCUSSION Tomasz Chmielewski 8 participants 11 messages Jan 19, 2011

lore
Share & tools
lore
#0 lore raw

Is it reasonable to set up Ceph on two nodes, which are Ceph clients at the same time?

Say, we have two machines:

ceph1 -- ceph2

On each of them, Ceph filesystem is mounted in /shared, which is used by services like a webserver or a mailserver.

Is it a reasonable approach?

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org
#1 lore raw
Quoted 6 lines · Tomasz Chmielewski

Is it reasonable to set up Ceph on two nodes, which are Ceph clients at the same time?

Say, we have two machines:

Quoted 7 lines

 ceph1 -- ceph2

On each of them, Ceph filesystem is mounted in /shared, which is used by services like a webserver or a mailserver.

Is it a reasonable approach?

Somehow I could not really run a reliable benchmarking (freezing) when the ceph-client was sitting on the same machine.
It might've fixed now, but maybe you also need good machines too! --
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Tomasz Chmielewski

Hi Thomas,

I think the answer is Yes and No on this question, the devs might have another approach for your situation.

If you would do this, you would have a MON, MDS and OSD on every server, in theory that would work. Mounting would be done by connecting to on of the MON's (doesn't matter which one).

But Ceph requires, well, advises a odd number of monitors (Source:
http://ceph.newdream.net/wiki/Designing_a_cluster )

So you would require a third node which is running your third monitor to keep track of both nodes.

My advise, for two nodes, use something like DRBD in Primary <> Primary and use a cluster filesystem like OCFS2.

Wido

Quoted 15 lines · Tomasz Chmielewski

Is it reasonable to set up Ceph on two nodes, which are Ceph clients at the same time?

Say, we have two machines:

   ceph1 -- ceph2

On each of them, Ceph filesystem is mounted in /shared, which is used by services like a webserver or a mailserver.

Is it a reasonable approach?

#3 lore raw

would you recommend me a solution to store xen-imgfile

would you recommend me a solution to store xen-imgfile
1. stability
2. throughout
3. redundancy
If ceph suitable for storing xen-imgfile??

#4 lore raw

Re: would you recommend me a solution to store xen-imgfile

Hi Longguang,

Quoted 5 lines · Longguang Yue

would you recommend me a solution to store xen-imgfile
1. stability
2. throughout
3. redundancy
If ceph suitable for storing xen-imgfile??

I would suggest using the kernel RBD driver, now present in 2.6.37. See

http://ceph.newdream.net/wiki/Rbd

sage

#5 lore raw
In reply to Wido den Hollander
Quoted 9 lines · Wido den Hollander

Hi Thomas,

I think the answer is Yes and No on this question, the devs might have another approach for your situation.

If you would do this, you would have a MON, MDS and OSD on every server, in theory that would work. Mounting would be done by connecting to on of the MON's (doesn't matter which one).

Quoted 8 lines

But Ceph requires, well, advises a odd number of monitors (Source:
http://ceph.newdream.net/wiki/Designing_a_cluster )

So you would require a third node which is running your third monitor to keep track of both nodes.

My advise, for two nodes, use something like DRBD in Primary<> Primary and use a cluster filesystem like OCFS2.

Currently, I'm running glusterfs in such a scenario (two servers, each being also clients), but I wanted to give ceph a try (glusterfs has some performance issues with lots of small files), also because of its nice features (snapshots, rbd etc.).

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org
#6 lore raw
Quoted 17 lines · Tomasz Chmielewski
Quoted 16 lines · Wido den Hollander

Hi Thomas,

I think the answer is Yes and No on this question, the devs might have another approach for your situation.

If you would do this, you would have a MON, MDS and OSD on every server, in theory that would work. Mounting would be done by connecting to on of the MON's (doesn't matter which one).

But Ceph requires, well, advises a odd number of monitors (Source:
http://ceph.newdream.net/wiki/Designing_a_cluster )

So you would require a third node which is running your third monitor to keep track of both nodes.

Quoted 7 lines
Quoted 2 lines

My advise, for two nodes, use something like DRBD in Primary<>  Primary and use a cluster filesystem like OCFS2.

Currently, I'm running glusterfs in such a scenario (two servers, each being also clients), but I wanted to give ceph a try (glusterfs has some performance issues with lots of small files), also because of its nice features (snapshots, rbd etc.).

Rather than running 3 monitors you could just put a monitor on one of the machines -- your cluster will go down if it fails, but in a 2-node system it's not like resilience from one-node failure would be very helpful anyway.

However, there is a serious issue with running clients and servers on one machine, which may or may not be a problem depending on your use
case: Deadlock becomes a significant possibility. This isn't a problem we've come up with a good solution for, unfortunately, but imagine you're writing a lot of files to Ceph. Ceph dutifully writes them and the kernel dutifully caches them. You also have a lot of write activity so the Ceph kernel client is doing local caching. Then the kernel comes along and says "I'm low on memory! Flush stuff to disk!" and the kernel client tries to flush it out...which involves creating another copy of the data in memory on the same machine. Uh-oh! Now if you use the FUSE client this won't be an issue, but your performance also won't be so good. :/
-Greg
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 8 lines · Gregory Farnum
Quoted 4 lines

Currently, I'm running glusterfs in such a scenario (two servers, each being also clients), but I wanted to give ceph a try (glusterfs has some performance issues with lots of small files), also because of its nice features (snapshots, rbd etc.).

Rather than running 3 monitors you could just put a monitor on one of the machines -- your cluster will go down if it fails, but in a 2-node system it's not like resilience from one-node failure would be very helpful anyway.

OK, I could imagine starting the monitor on just one node i.e. with the help of heartbeat - so if the node with the monitor goes down, heartbeat starts the monitor process on the other machine.

Quoted 3 lines

However, there is a serious issue with running clients and servers on one machine, which may or may not be a problem depending on your use
case: Deadlock becomes a significant possibility.

Sounds like the "freezes" issue mentioned by Dong Jin Lee?

Quoted 8 lines

This isn't a problem
we've come up with a good solution for, unfortunately, but imagine you're writing a lot of files to Ceph. Ceph dutifully writes them and the kernel dutifully caches them. You also have a lot of write activity so the Ceph kernel client is doing local caching. Then the kernel comes along and says "I'm low on memory! Flush stuff to disk!" and the kernel client tries to flush it out...which involves creating another copy of the data in memory on the same machine. Uh-oh!

Uh-oh, it doesn't sound encouraging, and will likely happen sooner or later.

Would some sort of zero-copy help here? But perhaps it's not that easy to solve, otherwise, we wouldn't be discussing it here.

I think swapping over NFS (or, iSCSI) has a similar problem ("need to write, but the network buffer is full, so we can't write over network -> deadlock"), and there were some patches floating around some years ago to solve it. Not sure what's the state of it and how similar it is to Ceph though.

Last I checked, 2 < 3, so having a budget HA solution which just needed 2 servers instead of 3 would be a great thing to have! ;)

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org
#8 lore raw
In reply to Gregory Farnum
Quoted 4 lines · Gregory Farnum

However, there is a serious issue with running clients and servers on one machine, which may or may not be a problem depending on your use
case: Deadlock becomes a significant possibility. This isn't a problem we've come up with a good solution for, unfortunately, but imagine

Quoted 8 lines

you're writing a lot of files to Ceph. Ceph dutifully writes them and the kernel dutifully caches them. You also have a lot of write activity so the Ceph kernel client is doing local caching. Then the kernel comes along and says "I'm low on memory! Flush stuff to disk!" and the kernel client tries to flush it out...which involves creating another copy of the data in memory on the same machine. Uh-oh! Now if you use the FUSE client this won't be an issue, but your performance also won't be so good. :/

If you knew what the maximum memory consumption for the daemons would be, you could use mlock to lock all those pages into memory (make them unswappable.) Then you could use rlimit to ensure that if the daemon ever tried to allocate more than that, it would be killed.

That would prevent the scenario you outlined above where there is not enough memory to flush the page cache. Of course, to do this, we would need to reduce memory consumption and make it deterministic for this to be feasible.

cheers,
Colin

#9 lore raw
Quoted 4 lines · Colin McCabe

If you knew what the maximum memory consumption for the daemons would be, you could use mlock to lock all those pages into memory (make them unswappable.) Then you could use rlimit to ensure that if the daemon ever tried to allocate more than that, it would be killed.

The classic nfs loopback mount deadlock is less about how much memory the daemons are grabbing via malloc etc, and more about the buffer cache management in kernel.

With a "loopback ceph", pressure from activity on the kernel ceph client mountpoint might interact badly with the buffer cache the OSD needs to work well, whether the OSD userspace tries to limit itself or not.

It's one of those "it'll work until you have a bad day" things.

http://www.webservertalk.com/archive242-2007-10-2051163.html

https://bugzilla.redhat.com/show_bug.cgi?id=489889

http://lkml.org/lkml/2006/12/14/448

http://docs.google.com/viewer?a=v&q=cache:ONtIKJFSC7QJ:https://tao.truststc.org/Members/hweather/advanced_storage/Public%2520resources/network/nfs_user+nfs+loopback+deadlock+linux&hl=en&gl=us&pid=bl&srcid=ADGEESgpaVYYNoh2pmvPVQ9I_bpLLcoF3GJIMKavomIHNgTb-cbii6RVtWg28poJKdHBqQgKGXzVA2NOsC25FtWMP3yywTfNkX9N26IrKVIcVA9eRz6ZGBx1_Ur0JerUrfBQlPcmcBBz&sig=AHIEtbSjGX_hCVny345iFSq7WKBvxNZmIw
(slide 5)

Signature · 1 line
:(){ :|:&};:
#10 lore raw
Quoted 9 lines · Tommi Virtanen
Quoted 4 lines · Colin McCabe

If you knew what the maximum memory consumption for the daemons would be, you could use mlock to lock all those pages into memory (make them unswappable.) Then you could use rlimit to ensure that if the daemon ever tried to allocate more than that, it would be killed.

The classic nfs loopback mount deadlock is less about how much memory the daemons are grabbing via malloc etc, and more about the buffer cache management in kernel.

My understanding is that nfsd tries to allocate memory, which turns out to be impossible because the page cache is occupying that memory, and requires nfsd to drain.

I guess the question you are asking is whether nfsd just doing I/O requires kernel memory that might not be available. I'm not entirely sure about the answer to that. Unfortunately, none of those links has any information on the subject (I had high hopes for the lkml one, but it was about an unrelated race in NFS).

Colin