Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Mnesia locking

akarui
Posted: Thu May 29, 2008 5:54 pm Reply with quote
Joined: 11 Feb 2008 Posts: 1
Hi,

I have an application that uses mnesia. I am load testing it using tsung.

After a few seconds the application just grinds to a halt. When I look at my processes through appmon, they all show the info similar to the one below

Node: '<somenode>', Process: <0.1750.0>
[{current_function,{mnesia_locker,l_req_rec,2}},
{initial_call,{erlang,apply,2}},
{status,waiting},
{message_queue_len,0},
{messages,[]},
{links,[<0.123.0>,<0.73.0>]},
{dictionary,
[{mnesia_activity_state,
{mnesia,{tid,147188,<0.1750.0>},{tidstore,3222,[],1}}}]},
{trap_exit,false},
{error_handler,error_handler},
{priority,normal},
{group_leader,<0.100.0>},
{total_heap_size,198015},
{heap_size,196418},
{stack_size,43},
{reductions,25226},
{garbage_collection,[{fullsweep_after,65535}]},
{suspending,[]}]

The all show current function as mnesia:locker.
Each of my processes performs a transaction which is a mixture of one-two reads and one-two writes. Although they read the same records, they do not write the same records. Also I have used mnesia:dirty_update_counter in places.

If anyone has some hints on how to go about finding the cause for the problem, a reply will be highly appreciated. Thanks!
View user's profile Send private message
francesco
Posted: Mon Jun 02, 2008 12:03 pm Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
Are you aware you can turn on the mnesia debug flags? From the mnesia manual page:

(http://www.erlang.org/doc/man/mnesia.html)

-mnesia debug Level Controls the debug level of Mnesia. Possible values are:

none
No trace outputs at all. This is the default setting.
verbose
Activates tracing of important debug events. These debug events generate {mnesia_info, Format, Args} system events. Processes may subscribe to these events with mnesia:subscribe/1. The events are always sent to Mnesia's event handler.
debug
Activates all events at the verbose level plus full trace of all debug events. These debug events generate {mnesia_info, Format, Args} system events. Processes may subscribe to these events with mnesia:subscribe/1. The events are always sent to the Mnesia event handler. On this debug level, the Mnesia event handler starts subscribing to updates in the schema table.
trace
Activates all events at the level debug. On this debug level, the Mnesia event handler starts subscribing to updates on all Mnesia tables. This level is only intended for debugging small toy systems since many large events may be generated.

Hope this helps.

Francesco
--
http://www.erlang-consulting.com
View user's profile Send private message Visit poster's website
marstein
Posted: Fri Jun 27, 2008 10:55 pm Reply with quote
Joined: 25 Jun 2008 Posts: 3 Location: Palo Alto, CA, USA
francesco wrote:
The events are always sent to Mnesia's event handler.


Francesco - thanks a lot. I have the same problem and have been trying to use pman, dbg:tracer, fprof, cprof and et to find clues on what is wrong. The problem is that the problem occurs only when there are a lot of requests coming in to mnesia and a lot of processes running. This leads to a fprof report that I cancelled after 450k lines.
We found in pman that the mnesia locking process gets a real long message queue.


For the advanced newbie it is hard to understand how the mnesia debug events can be made visible. What do I have to code? Is there an example?

It is probably a good idea to look at the efficiency guide's section on mnesia.
View user's profile Send private message Yahoo Messenger

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum