Skip to contentSkip to conversation

Why not Yahoo/Apache Zookeeper? Serialization format?

DISCUSSION Evan Jones 2 participants 4 messages Nov 5, 2009

lore
Share & tools
lore

Evan Jones

author
#0 lore raw

The hail project seems very interesting. Two quick questions:

a) Was Yahoo Zookeeper considered instead of reimplementing these ideas as CLD? Was it discarded for some reason?

b) Has there been any consideration for re-using an existing serialization format (XDR, Thrift, Protocol Buffers, whatever)?

I'm just interested in why existing infrastructure may be inappropriate for Hail. Part of my motivation is that I hope to see some "consolidation" in this space: I would like there to be a small number (1 or 2) of various distributed systems infrastructure, so we might start to see some real "compatibility." Right now it seems as though everyone decides to build absolutely everything from scratch.

Thanks,

Evan Jones

--
Evan Jones
http://evanjones.ca/

#1 lore raw
Quoted 4 lines · Evan Jones

The hail project seems very interesting. Two quick questions:

a) Was Yahoo Zookeeper considered instead of reimplementing these ideas as CLD? Was it discarded for some reason?

Yes, I think it departed too much from a desirable filesystem-like API.
Using lock/unlock/trylock for ordered contention resolution, leader
election, garbage collection, and similar tasks is a convenient model. CLD will probably be more Chubby-like than Zookeeper.

At the time I started CLD, it looked like Zookeeper was a project on life support, Yahoo was bleeding money, and the move to Apache looked like a dump-n-run project with no promising future. AT THE TIME it seemed like something to avoid; but does still continue to have a life and receive attention, so this assessment was probably too conservative and premature.

Quoted 2 lines

b) Has there been any consideration for re-using an existing serialization format (XDR, Thrift, Protocol Buffers, whatever)?

In what context should these be considered? We are certainly open to using open, documented protocols -- one big reason why Amazon S3 (HTTP REST) and NFSv4 were chosen as production examples for the tabled and nfs4d projects, respectively.

chunkd's protocol is custom because I'm not aware of a highly efficient binary network storage protocol that fits its niche. It sits somewhere in between nbd and iSCSI+{SBC|OSD}, technology-wise. chunkd provides storage at a low level; data is already serialized by the time it reaches chunkd.

Quoted 6 lines

I'm just interested in why existing infrastructure may be inappropriate for Hail. Part of my motivation is that I hope to see some "consolidation" in this space: I would like there to be a small number (1 or 2) of various distributed systems infrastructure, so we might start to see some real "compatibility." Right now it seems as though everyone decides to build absolutely everything from scratch.

Right now cloud computing is a hotbed of activity, a very exciting time.
I would rather see -more- interesting projects, than less, at this
juncture. Open source cloud computing is really just in its infancy, even though its been deployed in closed source production for years.

Jeff

author
#2 lore raw
Quoted 1 line · Jeff Garzik

Yes, I think it departed too much from a desirable filesystem-like API. Using lock/unlock/trylock for ordered contention resolution, leader election, garbage collection, and similar tasks is a convenient model. CLD will probably be more Chubby-like than Zookeeper.

I haven't actually studied the Zookeeper API closely enough to be aware of these differences. I'll take a closer look.

My interest in Zookeeper is just that implementing replicated state machine protocols (eg. Paxos), is surprisingly tricky. Re-using a somewhat well tested implementation that has been deployed in production seems like it would save considerable time. Although I will be the first to admit that doing it yourself is a heck of a lot more fun.

Quoted 3 lines
Quoted 2 lines

b) Has there been any consideration for re-using an existing serialization format (XDR, Thrift, Protocol Buffers, whatever)?

In what context should these be considered? We are certainly open to using open, documented protocols -- one big reason why Amazon S3 (HTTP REST) and NFSv4 were chosen as production examples for the tabled and nfs4d projects, respectively.

For network message serialization and deserialization. For example, CLD and chunkd both have have defined their own message structures. These could be expressed in some pseudo-standard serialization format. This (theoretically) makes it easier to write clients in other languages, as the serialization/deserialization would be automatic rather than needing to be re-implemented. This makes life somewhat easier when there are protocol changes. Some of these may provide other advantages, such as assisting with seamless upgrades.

Additionally, if Project Hail is successful, and people start building distributed systems on top of its components, it might be nice if it included some sort of "standard" protocol/message format, so that it is easier for service provided by X to interact with service provided by Y.

Quoted 1 line

chunkd's protocol is custom because I'm not aware of a highly efficient binary network storage protocol that fits its niche.

Although the "message header" part could potentially be encoded using some sort of serialization tool.

Thanks for your insight!

Evan

--
Evan Jones
http://evanjones.ca/

#3 lore raw
Quoted 6 lines · Evan Jones
Quoted 4 lines · Jeff Garzik

Yes, I think it departed too much from a desirable filesystem-like API. Using lock/unlock/trylock for ordered contention resolution, leader election, garbage collection, and similar tasks is a convenient model. CLD will probably be more Chubby-like than Zookeeper.

Quoted 8 lines

I haven't actually studied the Zookeeper API closely enough to be aware of these differences. I'll take a closer look.

My interest in Zookeeper is just that implementing replicated state machine protocols (eg. Paxos), is surprisingly tricky. Re-using a somewhat well tested implementation that has been deployed in production seems like it would save considerable time. Although I will be the first to admit that doing it yourself is a heck of a lot more fun.

That's why CLD uses db4 -- the db4 codebase has years of replication experience in the field, including fixing major criticism (incl. Paxos-related criticism) leveled publicly by Google in the Chubby-related whitepapers.

Once the CLD client is ready, I'll apply the attached patch to the server, and replication/failover/high availability will be fully enabled in CLD.

Long term, I would like to replace the db4 replication with Paxos + a more simple write-ahead logging database, but that is in the realm of hopes and dreams. Must get a working, stable CLD version 1.0 out the door first :)

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

b) Has there been any consideration for re-using an existing serialization format (XDR, Thrift, Protocol Buffers, whatever)?

For network message serialization and deserialization. For example, CLD and chunkd both have have defined their own message structures. These could be expressed in some pseudo-standard serialization format. This

Quoted 5 lines
Quoted 2 lines

chunkd's protocol is custom because I'm not aware of a highly efficient binary network storage protocol that fits its niche.

Although the "message header" part could potentially be encoded using some sort of serialization tool.

Gotcha; I understand your meaning now.

CLD would be well suited for such an effort, if you were interested in tackling that project. Writing client APIs/libraries for CLD is non-trivial, and will get even more complex once the client caching is added. Anything to reduce client complexity, and encourage the spread of CLD into other programming languages, is welcome.

On the other hand, chunkd is a bit of a special case. It aims to be an implementation of a highly efficient, low level data storage protocol. We will want to hammer out all the overhead possible, and perhaps in a year or two, submit the protocol for inclusion in the IETF RFC collection. Even XDR is too much overhead and annoyance, for chunkd, in my opinion :)

Jeff

server/cld.h +20 -0
index 537f07a..027361e 100644
@@ -94,6 +94,15 @@ struct msg_params {
 	size_t			msg_len;
 };
 
+enum st_cldb {
+	ST_CLDB_INIT,
+	ST_CLDB_OPEN,
+	ST_CLDB_ACTIVE,
+	ST_CLDB_MASTER,
+	ST_CLDB_SLAVE,
+	ST_CLDBNUM
+};
+
 struct server_stats {
 	unsigned long		poll;		/* number polls */
 	unsigned long		event;		/* events dispatched */
@@ -113,6 +122,17 @@ struct server {
 	int			pid_fd;
 
 	char			*port;		/* bind port */
+	unsigned short		rep_port;	/* db4 replication port */
+
+	char			*myhost;
+	char			*force_myhost;
+	GList			*rep_remotes;
+
+	unsigned int		n_peers;	/* total peers in cell */
+
+	int			rep_pipe[2];
+
+	enum st_cldb		state_cldb, state_cldb_new;
 
 	struct cldb		cldb;		/* database info */
 
server/cldb.c +61 -8

119 lines not on this page · raw message

server/cldb.h +8 -1
index ac108ce..dbe9ea0 100644
@@ -108,6 +108,11 @@ enum db_event {
 	CLDB_EV_NONE, CLDB_EV_CLIENT, CLDB_EV_MASTER, CLDB_EV_ELECTED
 };
 
+struct db_remote {	/* remotes for cldb_init */
+	char		*host;
+	unsigned short	port;
+};
+
 struct cldb {
 	bool		is_master;
 	bool		keyed;			/* using encryption? */
@@ -134,7 +139,9 @@ struct cldb {
 
 extern int cldb_init(struct cldb *cldb, const char *db_home, const char *db_password,
 	      unsigned int env_flags, const char *errpfx, bool do_syslog,
-	      unsigned int flags, void (*cb)(enum db_event));
+	      GList *remotes, char *rep_host, unsigned short rep_port,
+	      int n_peers, void (*cb)(enum db_event));
+extern int cldb_up(struct cldb *cldb, unsigned int flags);
 extern void cldb_down(struct cldb *cldb);
 extern void cldb_fini(struct cldb *cldb);
 
server/cldbadm.c +5 -3
index 37e8e36..9342f66 100644
@@ -78,7 +78,8 @@ int main(int argc, char *argv[])
 	}
 
 	if (cldb_init(&cld_adm.cldb, cld_adm.data_dir, NULL,
-		      DB_RECOVER, "cldbadm", false, 0, NULL))
+		      DB_RECOVER, "cldbadm", false,
+		      NULL, NULL, 0, 0, NULL))
 		goto err_dbopen;
 
 	switch (cld_adm.mode) {
@@ -142,8 +143,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
  * Stubs for contents of cldb.c
  */
 int cldb_init(struct cldb *cldb, const char *db_home, const char *db_password,
-	      unsigned int env_flags, const char *errpfx, bool do_syslog,
-	      unsigned int flags, void (*cb)(enum db_event))
+              unsigned int env_flags, const char *errpfx, bool do_syslog,
+              GList *remotes, char *rep_host, unsigned short rep_port,
+              int n_peers, void (*cb)(enum db_event))
 {
 
 	return 0;
server/server.c +271 -15

405 lines not on this page · raw message

test/pid-exists +8 -5
index 351b4f1..4fa2275 100755
@@ -1,9 +1,12 @@
 #!/bin/sh
 
-if [ ! -f cld.pid ]
-then
-	echo "pid file not found."
-	exit 1
-fi
+for n in 1 2 3
+do
+	if [ ! -f cld$n.pid ]
+	then
+		echo "cld$n.pid not found."
+		exit 1
+	fi
+done
 
 exit 0
test/prep-db +11 -8
index 353ca4a..3e4fb60 100755
@@ -2,13 +2,16 @@
 
 DATADIR=data
 
-mkdir -p $DATADIR
-
-if [ ! -d $DATADIR ]
-then
-	rm -rf $DATADIR
-	echo "test database dir not found."
-	exit 1
-fi
+for n in 1 2 3
+do
+	mkdir -p $DATADIR/n$n/data
+
+	if [ ! -d $DATADIR/n$n/data ]
+	then
+		rm -rf $DATADIR
+		echo "test database dir for node $n not found."
+		exit 1
+	fi
+done
 
 exit 0
test/start-daemon +22 -4
index 4cb9fd7..06b3250 100755
@@ -1,13 +1,31 @@
 #!/bin/sh
 
-if [ -f cld.pid ]
+if [ -f cld1.pid -o -f cld2.pid -o -f cld3.pid ]
 then
-	echo "pid file found.  daemon still running?"
+	echo "pid file found.  daemons still running?"
 	exit 1
 fi
 
-../server/cld -P cld.pid -d "$PWD/data" -p 18181 -E
+../server/cld -d "$PWD/data/n1/data" -p 18181 -r 19181 -P cld1.pid -E	\
+	-D 2 -S 3			\
+	-m localhost.localdomain	\
+	-R localhost.localdomain:19182	\
+	-R localhost.localdomain:19183
 
-sleep 3
+../server/cld -d "$PWD/data/n2/data" -p 18182 -r 19182 -P cld2.pid -E	\
+	-D 2 -S 3			\
+	-m localhost.localdomain	\
+	-R localhost.localdomain:19181	\
+	-R localhost.localdomain:19183
+
+../server/cld -d "$PWD/data/n3/data" -p 18183 -r 19183 -P cld3.pid -E	\
+	-D 2 -S 3			\
+	-m localhost.localdomain	\
+	-R localhost.localdomain:19181	\
+	-R localhost.localdomain:19182
+sleep 1
+
+echo "      start-daemon: Waiting 20s, for daemons to start up..."
+sleep 20
 
 exit 0
test/stop-daemon +8 -8
index 27d985e..7cb4a6c 100755
@@ -1,23 +1,23 @@
 #!/bin/sh
 
-if [ ! -f cld.pid ]
+if [ ! -f cld1.pid -o ! -f cld2.pid -o ! -f cld3.pid ]
 then
-	echo no daemon pid file found.
+	echo at least one daemon pid file missing.
 	exit 1
 fi
 
-kill `cat cld.pid`
+kill `cat cld*.pid`
 
 for n in 0 1 2 3 4 5 6 7 8 9
 do
-	if [ ! -f cld.pid ]
+	if [ -f cld1.pid -o -f cld2.pid -o -f cld3.pid ]
 	then
+		sleep 1
+	else
 		exit 0
 	fi
-
-	sleep 1
 done
 
-echo "PID file not removed, after signal sent."
-rm -f cld.pid
+echo "PID file(s) not removed, after signal sent."
+rm -f cld*.pid
 exit 1