From 296ef4de7d2e72b8b1a92b423904f8024c6165e3 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Wed, 1 Aug 2018 09:05:00 +0200 Subject: [PATCH] explicitly enable batching in pubsub Automatic batching is not yet implemented but: it dramatically enhances performance in throughput tests, and enabling it in the config breaks manual publication of data in pubsub. For the time being, it makes more sense to enable manual batching programmatically and force the data out when needed. Signed-off-by: Erik Boasson --- src/tools/pubsub/pubsub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tools/pubsub/pubsub.c b/src/tools/pubsub/pubsub.c index 6067fa0..5a9f0d8 100755 --- a/src/tools/pubsub/pubsub.c +++ b/src/tools/pubsub/pubsub.c @@ -1222,6 +1222,8 @@ static void pub_do_auto(const struct writerspec *spec) { } if (++bi == spec->burstsize) { while (((ntot / spec->burstsize) / ((t - tfirst0) / 1e9 + 5e-3)) > spec->writerate && !termflag) { + /* FIXME: only doing this manually because batching is not yet implemented properly */ + dds_write_flush(spec->wr); dds_sleepfor(DDS_MSECS(10)); t = dds_time(); } @@ -1292,11 +1294,17 @@ static char *pub_do_nonarb(const struct writerspec *spec, uint32_t *seq) { if (!accept_error(command, result)) exit(1); } + /* FIXME: only doing this manually because batching is not yet implemented properly */ + dds_write_flush(spec->wr); if (spec->dupwr && (result = fn(spec->dupwr, &d, tstamp)) != DDS_RETCODE_OK) { printf ("%s %d(dup): error %d (%s)\n", get_write_operstr(command), k, (int) result, dds_err_str(result)); if (!accept_error(command, result)) exit(1); } + if (spec->dupwr) { + /* FIXME: only doing this manually because batching is not yet implemented properly */ + dds_write_flush(spec->wr); + } d.seq++; break; } @@ -2492,6 +2500,7 @@ int MAIN(int argc, char *argv[]) { common_init(argv[0]); set_systemid_env(); + dds_write_set_batch(true); // FIXME: hack (the global batching flag is a hack anyway) { char **ps = (char **) dds_alloc(sizeof(char *) * (argc - os_get_optind()));