Strange mnesia behaviour

Anders Nygren <>
Mon Aug 25 17:20:19 CEST 2003


Hi
Enclosed are two files for demonstrating the problem.

1> mnesia:create_schema([node()]).
ok
%% create test table
2> proc1:create_tab().

%% Send 1000 messages

21> load_test:start(1000,1,1000).
Starting: {1061,824066,922527}
ok
Finished: {1061,824067,57799}
Duration: 0.135272

%% send 4000 messages

22> load_test:start(4000,1,4000).
Starting: {1061,824104,408645}
ok
Finished: {1061,824105,433962}
Duration: 1.02532
%% NOTE: Duration more than 4x time for 1000 msgs.

%% send 10000 msgs
23> load_test:start(10000,1,10000).
Starting: {1061,824183,532563}
ok
Finished: {1061,824190,685861}
Duration: 7.15330

%% And now for the real fun
%% Send 10000 msgs, but sleep 1 sec, after 5000 msgs
24> load_test:start(10000,1000,5000).
Starting: {1061,824264,759878}
ok
Finished: {1061,824268,418335}
Duration: 3.65846   %% !!!!!!!!!

eprof shows that flush_downs is the guilty.
Warning: do not try profileing witheprof on 10000
messages, 4000 msg takes 25 secs with profiling on
my 2.4 Ghz P4.
/Anders

 --- Dan Gudmundsson <> skrev: > 
> Hmm
> 
> flush_downs cleans the msg queue, with alot msgs in
> it, it takes some 
> time..
> 
> Can you email me the test program?
> 
> /Dan
> 
> Anders Nygren writes:
>  > Hi
>  > I have found a strange thing in mnesia. I was
> trying
>  > to do some throughput measurement on a process.
>  > 
>  > My process does the following:
>  > 1, receive one message
>  > 2, make one mnesia:select
>  > 3, send one message
>  > 
>  > My test was to send N identicat messages to my
> process
>  > and measure the time it took to process all
> messages.
>  > To my suprise the times grew non-linearly with N.
>  > eprof shows that
>  > N = 10 - > mnesia:flush_downs/0 is called 55
> times
>  > N = 100 -> mnesia:flush_downs/0 is called 5000
> times
>  > N = 4000 -> a whopping 4 million times.
>  > 
>  > Also if I run the test twice with 50 messages I
> get
>  > 2500 mnesia:flush_downs, but when I run one test
> with
>  > 100 messages there are 5000.
>  > 
>  > I the mnesia table has one record.
>  > I am using a single node -> no distribution.
>  > The table is type bag, disc_copy.
>  > I am using R9C on Suse 8.2.
>  > 
>  > Is there something wrong with mnesia or is there 
>  > something I dont understand?
>  > 
>  > /Anders
>  > 
>  > Yahoo! Mail - Gratis: 6 MB lagringsutrymme,
> spamfilter och virusscan. Se mer på
> http://se.mail.yahoo.com
>  

Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer på http://se.mail.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: files.tar.gz
Type: application/x-tar
Size: 1709 bytes
Desc: files.tar.gz
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030825/b0a70029/attachment.tar>


More information about the erlang-questions mailing list