[erlang-questions] Benchmarking Erlang: Deathmatch of gb_trees, dict, ets, mnesia ... and registered names
Joel Reymont
joelr1@REDACTED
Thu Oct 9 13:26:33 CEST 2008
%% mnesia ram_copies on two nodes
%% node #1
mothership:opti joelr$ erl -sname 1
(1@REDACTED)1> map6:setup1(['1@REDACTED', '2@REDACTED']).
{atomic,ok}
(1@REDACTED)2> mnesia:info().
...
---> Active tables <---
schema : with 2 records occupying 553 words of mem
xref : with 0 records occupying 312 words of mem
...
running db nodes = ['2@REDACTED','1@REDACTED']
...
[{'1@REDACTED',ram_copies},{'2@REDACTED',ram_copies}] =
[xref,schema]
5 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok
%% node #2
mothership:opti joelr$ erl -sname 2
(2@REDACTED)2> mnesia:start().
ok
(2@REDACTED)3> mnesia:change_config(extra_db_nodes, ['1@REDACTED']).
{ok,['1@REDACTED']}
(2@REDACTED)4> mnesia:info().
...
---> Active tables <---
schema : with 2 records occupying 553 words of mem
xref : with 0 records occupying 312 words of mem
...
running db nodes = ['1@REDACTED','2@REDACTED']
...
[{'1@REDACTED',ram_copies},{'2@REDACTED',ram_copies}] =
[xref,schema]
5 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok
%% node #1
(1@REDACTED)3> map6:test(10000).
Populate: 0.1193
Lookup: 5.0006
ok
(1@REDACTED)4> map6:test(100000).
Populate: 1.4206
Lookup: 5.0003
ok
(1@REDACTED)5> map6:test(1000000).
Populate: 1.8590
Lookup: 5.0009
ok
No difference from ets and mnesia ram_copies on a single node!
Here's proof that we did commit to the other node:
%% node #2
(2@REDACTED)5> mnesia:info().
---> Processes holding locks <---
Lock: {{xref,93850},write,{tid,16678,<5738.84.0>}}
Lock: {{xref,999482},write,{tid,16671,<5738.86.0>}}
---> Participant transactions <---
Tid: 16671 (owned by <5738.86.0>)
with participant objects {commit,'2@REDACTED',presume_commit,
[{{xref,999482},{xref,
999482,999482},write}],
[],[],[],[],[]}
---> Active tables <---
schema : with 2 records occupying 553 words of mem
xref : with 16668 records occupying 186219 words of mem
...
5 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
2 held locks, 0 in queue; 0 local transactions, 1 remote
0 transactions waits for other nodes: []
ok
More information about the erlang-questions
mailing list