Home

Awesome

mstore Build Status

MStore is a experimental metric store build in erlang, the primary functions are open, new, get and put.

A datastore is defined by:

For each chunk a index is created (defining the position of the metrics) and a datafile which holds the values. This makes reading a number of metrics as simple as a calculation and a sequential read.

For a store holding 1000 metrics writing to the the numbers 0-999 would be in the file 0, 1000-1999 would be in the second file etc.

Idea

The basic idea is to take advantage of the special characteristics metrics have and modern filesystems. The following assumptions about metrics and filesystems are taken:

File Layout

Set

A set allows to group metrics into a hash ring, this limits the size of single files open. The directory layout will be like this:

<base dir>/<chash key>/<offset>.{mstore,idx} - data and store index files
<base dir>/mstore - set index file

Index File (for a set)

The index file is simply a Erlang file that can be read via consult:

{FileSize, CHashSize, Seed, Metrics}.

Store

Data File

Currently data is fixed to 64 bit (8 byte) integers this means a data file is layed out like this:

<metric 1:FileSize*8><metric 2:FileSize*8><metric 2:FileSize*8>

Index File (for a metric)

The index file is simply a Erlang file that can be read via consult:

{Offse, FileSize, [{Metric, Index}]}.