From 9e41162e65f7c0dda8d8705e7c00e639cfca652f Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 20 May 2015 18:44:04 +0900 Subject: [PATCH] Minor machi_basho_bench_driver changes --- priv/basho_bench.append-example.config | 6 ++++++ priv/basho_bench.read-example.config | 6 ++++++ src/machi_basho_bench_driver.erl | 7 ++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/priv/basho_bench.append-example.config b/priv/basho_bench.append-example.config index e7f5345..01cd6e8 100644 --- a/priv/basho_bench.append-example.config +++ b/priv/basho_bench.append-example.config @@ -17,6 +17,12 @@ %{concurrent, 10}. %% Here's a chain of (up to) length 3, all on localhost +%% Note: if any servers are down, and your OS/TCP stack has an +%% ICMP response limit such as OS X's "net.inet.icmp.icmplim" setting, +%% then if that setting is very low (e.g., OS X's limit is 50), then +%% you can have big problems with ICMP/RST responses being delayed and +%% interactive *very* badly with your test. +%% For OS X, fix using "sudo sysctl -w net.inet.icmp.icmplim=9999" {machi_server_info, [ {p_srvr,a,machi_flu1_client,"localhost",4444,[]}, diff --git a/priv/basho_bench.read-example.config b/priv/basho_bench.read-example.config index cc2cec1..1e4eb35 100644 --- a/priv/basho_bench.read-example.config +++ b/priv/basho_bench.read-example.config @@ -17,6 +17,12 @@ %{concurrent, 10}. %% Here's a chain of (up to) length 3, all on localhost +%% Note: if any servers are down, and your OS/TCP stack has an +%% ICMP response limit such as OS X's "net.inet.icmp.icmplim" setting, +%% then if that setting is very low (e.g., OS X's limit is 50), then +%% you can have big problems with ICMP/RST responses being delayed and +%% interactive *very* badly with your test. +%% For OS X, fix using "sudo sysctl -w net.inet.icmp.icmplim=9999" {machi_server_info, [ {p_srvr,a,machi_flu1_client,"localhost",4444,[]}, diff --git a/src/machi_basho_bench_driver.erl b/src/machi_basho_bench_driver.erl index 8e9899a..0652df1 100644 --- a/src/machi_basho_bench_driver.erl +++ b/src/machi_basho_bench_driver.erl @@ -65,6 +65,7 @@ }). -define(ETS_TAB, machi_keys). +-define(THE_TIMEOUT, 60*1000). -define(INFO(Str, Args), lager:info(Str, Args)). -define(WARN(Str, Args), lager:warning(Str, Args)). @@ -94,7 +95,7 @@ new(Id) -> run(append, KeyGen, ValueGen, #m{conn=Conn}=S) -> Prefix = KeyGen(), Value = ValueGen(), - case machi_cr_client:append_chunk(Conn, Prefix, Value) of + case machi_cr_client:append_chunk(Conn, Prefix, Value, ?THE_TIMEOUT) of {ok, Pos} -> EtsKey = ets:update_counter(?ETS_TAB, max_key, 1), true = ets:insert(?ETS_TAB, {EtsKey, Pos}), @@ -111,12 +112,12 @@ run(read, KeyGen, _ValueGen, #m{conn=Conn, max_key=MaxKey}=S) -> Idx = KeyGen() rem MaxKey, %% {File, Offset, Size, _CSum} = ets:lookup_element(?ETS_TAB, Idx, 2), {File, Offset, Size} = ets:lookup_element(?ETS_TAB, Idx, 2), - case machi_cr_client:read_chunk(Conn, File, Offset, Size) of + case machi_cr_client:read_chunk(Conn, File, Offset, Size, ?THE_TIMEOUT) of {ok, _Chunk} -> {ok, S}; {error, _}=Err -> ?ERROR("read file ~p offset ~w size ~w: ~w\n", - [File, Offset, Size]), + [File, Offset, Size, Err]), {error, Err, S} end.