Skip to content

Instantly share code, notes, and snippets.

@moonpolysoft
Created April 6, 2009 16:14
Show Gist options
  • Save moonpolysoft/90812 to your computer and use it in GitHub Desktop.
Save moonpolysoft/90812 to your computer and use it in GitHub Desktop.
test_storage_server_throughput() ->
configuration:start_link(#config{}),
{ok, Pid} = storage_server:start_link(ets_storage, db_key(throughput), through, 0, (2 bsl 31), undefined),
{Keys, _} = lib_misc:fast_acc(fun({List, Str}) ->
Mod = lib_misc:succ(Str),
{[Mod|List], Mod}
end, {[], "aaaaaaaa"}, 10000),
Vector = vector_clock:create(a),
Start = lib_misc:now_float(),
lists:foreach(fun(Key) ->
storage_server:put(Pid, Key, Vector, Key)
end, Keys),
lists:foreach(fun(Key) ->
storage_server:get(Pid, Key)
end, Keys),
End = lib_misc:now_float(),
?debugFmt("storage server can do ~p reqs/s", [20000/(End-Start)]),
storage_server:close(Pid).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment