Skip to content

Instantly share code, notes, and snippets.

@voluntas
Created August 7, 2010 08:48
Show Gist options
  • Save voluntas/512600 to your computer and use it in GitHub Desktop.
Save voluntas/512600 to your computer and use it in GitHub Desktop.
-module(sample).
-compile(export_all).
-record(store, {key, value}).
main() ->
crypto:start(),
mnesia:start(),
mnesia:create_table(store,
[{frag_properties,
[{node_pool, [node()]},
{n_fragments, 128}]},
{attributes, record_info(fields, store)}]),
F = fun(_) ->
add_store()
end,
lists:foreach(F, lists:duplicate(1000000, dummy)),
mnesia:info(),
crypto:stop(),
mnesia:stop(),
ok.
add_store() ->
F = fun() ->
Key = crypto:rand_bytes(32),
Value = crypto:rand_bytes(32),
mnesia:write(store, #store{key=Key, value=Value}, sticky_write)
end,
ok = mnesia:activity(async_dirty, F, [], mnesia_frag),
ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment