Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ensure fast startup times of mnesia

Tags:

erlang

mnesia

Erlang with mnesia/dets is famous for it slow startup times after a crash. Basically the same issue as with fsck on older filesystems.

But I also experience slow startup times after regular shutdowns: about 8 Minutes for 250 MB on-disk data on a beefy machine.

So I have to do something special on shutdown besides typing "q()."? Is there a way to speed up startup times?

like image 910
max Avatar asked Dec 27 '08 21:12

max


2 Answers

Things I found out so far:

  • disk_only_tables seem to result in much longer startup times than disk_tables
  • calling mnesia:create_table() with a new table type is not enough to change a table type. Use mnesia:change_table_copy_type()
  • Seems disk_only_tables don't shrink and don't load faster if you delete items.

I solved my issue by fixing the table type issue on two tables and shrinking my database size to 4 MB.

like image 104
max Avatar answered Sep 28 '22 04:09

max


In your supervisor, after all processes that write to mnesia are stopped, you should call:

application:stop(mnesia)

This will properly shut down mnesia on that node.

like image 25
Tautologistics Avatar answered Sep 28 '22 04:09

Tautologistics