From f49c93f96b60938fa3e3705e4671e3f50c628b59 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 20 Feb 2007 14:57:13 +1100 Subject: [PATCH] added --num-msgs option added TCP_NODELAY on tcp sockets (This used to be ctdb commit fa76cff388237adea98c2be0827c54334080256a) --- ctdb/ctdb_bench.c | 20 +++++++++++++------- ctdb/tcp/tcp_connect.c | 3 +++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ctdb/ctdb_bench.c b/ctdb/ctdb_bench.c index e1fcd1916d9..60d8b799042 100644 --- a/ctdb/ctdb_bench.c +++ b/ctdb/ctdb_bench.c @@ -43,6 +43,7 @@ static double end_timer(void) static int timelimit = 10; static int num_records = 10; +static int num_msgs = 1; static int num_repeats = 100; enum my_functions {FUNC_INCR=1, FUNC_FETCH=2}; @@ -152,6 +153,7 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev) int vnn=ctdb_get_vnn(ctdb); if (vnn == 0) { + int i; /* two messages are injected into the ring, moving in opposite directions */ int dest, incr; @@ -160,18 +162,21 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev) data.dptr = (uint8_t *)&incr; data.dsize = sizeof(incr); - incr = 1; - dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb); - ctdb_send_message(ctdb, dest, 0, data); - incr = -1; - dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb); - ctdb_send_message(ctdb, dest, 0, data); + for (i=0;ictdb; int error = 0; socklen_t len = sizeof(error); + int one = 1; if (getsockopt(tnode->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0 || error != 0) { @@ -64,6 +65,8 @@ static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *f /* tell the ctdb layer we are connected */ node->ctdb->upcalls->node_connected(node); + setsockopt(tnode->fd,IPPROTO_TCP,TCP_NODELAY,(char *)&one,sizeof(one)); + if (tnode->queue) { EVENT_FD_WRITEABLE(tnode->fde); }