Rev 65: added --num-msgs option in http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Tue Feb 20 03:57:13 GMT 2007
------------------------------------------------------------
revno: 65
revision-id: tridge at samba.org-20070220035713-jeodfq36sfuzodbs
parent: tridge at samba.org-20070220022445-wvaeozowrk8kjx0u
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-02-20 14:57:13 +1100
message:
added --num-msgs option
added TCP_NODELAY on tcp sockets
modified:
ctdb_bench.c ctdb_bench.c-20061219052637-2liagoglohxb6p7s-1
tcp/tcp_connect.c tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1
=== modified file 'ctdb_bench.c'
--- a/ctdb_bench.c 2007-02-16 03:48:27 +0000
+++ b/ctdb_bench.c 2007-02-20 03:57:13 +0000
@@ -43,6 +43,7 @@
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 @@
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 @@
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;i<num_msgs;i++) {
+ 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);
+ }
}
start_timer();
while (end_timer() < timelimit) {
- if (vnn == 0 && msg_count % 1000 == 0) {
+ if (vnn == 0 && msg_count % 10000 == 0) {
printf("Ring: %.2f msgs/sec (+ve=%d -ve=%d)\r",
msg_count/end_timer(), msg_plus, msg_minus);
fflush(stdout);
@@ -203,6 +208,7 @@
{ "self-connect", 0, POPT_ARG_NONE, &self_connect, 0, "enable self connect", "boolean" },
{ "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" },
{ "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" },
+ { "num-msgs", 'n', POPT_ARG_INT, &num_msgs, 0, "num_msgs", "integer" },
POPT_TABLEEND
};
int opt;
=== modified file 'tcp/tcp_connect.c'
--- a/tcp/tcp_connect.c 2007-02-20 02:22:18 +0000
+++ b/tcp/tcp_connect.c 2007-02-20 03:57:13 +0000
@@ -46,6 +46,7 @@
struct ctdb_context *ctdb = node->ctdb;
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 @@
/* 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);
}
More information about the samba-cvs
mailing list