concept Mnesia in category erlang

appears as: Mnesia
Erlang and OTP in Action

This is an excerpt from Manning's book Erlang and OTP in Action.

The TV application is mostly self-explanatory, so we leave it to you to play around with it and figure it out. The menus and icons provide options for sorting and polling, and you can also get more detailed information about a table, search for entries, and edit or delete entries on the fly. Keep TV in mind when you start using ETS tables and Mnesia in the coming chapters, if you want an easy way to see what’s going on with your data.

9.2. Distributed data storage with Mnesia

Mnesia is a lightweight, soft real time, distributed, replicated, transactional data store. It’s great at storing discrete chunks of Erlang data, particularly in RAM. Mnesia is native to Erlang and stores Erlang data as is—you never need to rewrite your data in any particular format just so you can put it in the database. This makes it the obvious first choice when it comes to picking a database for your application, as long as you know its limits.

Mnesia was never designed to replace SQL-style databases or manage hundreds of gigabytes of persistent data distributed over several dozens of computers; and although there are stories of this being done, we recommend against aiming for that kind of usage. But Mnesia is fantastic at smaller numbers of replicas and smaller units of data. It’s a good choice for reasonable amounts of persistent (disk-backed) data and great for runtime data that needs to be shared between processes, in particular if you need to distribute the data among multiple nodes for reasons of fault tolerance or efficiency. The key-to-pid mappings you want to implement are a good example of this.

How Mnesia got its name

When the Mnesia database was first created, the developer in charge of the project had a wry sense of humor and decided he would like to call it Amnesia. Management quickly informed him that there would be no database named Amnesia in Ericsson’s product line. The developer then chopped off that pesky A, giving us Mnesia instead. This is a good name: mnesia is the Greek word for memory.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest