{"id":13508500,"url":"https://github.com/dalmatinerdb/mstore","last_synced_at":"2025-10-21T15:49:54.583Z","repository":{"id":57539779,"uuid":"20512968","full_name":"dalmatinerdb/mstore","owner":"dalmatinerdb","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-27T17:16:45.000Z","size":2764,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-21T15:49:47.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalmatinerdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-05T05:30:18.000Z","updated_at":"2019-07-15T21:17:47.000Z","dependencies_parsed_at":"2022-09-26T18:31:47.392Z","dependency_job_id":null,"html_url":"https://github.com/dalmatinerdb/mstore","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/dalmatinerdb/mstore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalmatinerdb%2Fmstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalmatinerdb%2Fmstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalmatinerdb%2Fmstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalmatinerdb%2Fmstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalmatinerdb","download_url":"https://codeload.github.com/dalmatinerdb/mstore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalmatinerdb%2Fmstore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280290182,"owners_count":26305278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:53.997Z","updated_at":"2025-10-21T15:49:54.534Z","avatar_url":"https://github.com/dalmatinerdb.png","language":"Erlang","funding_links":[],"categories":["Logging"],"sub_categories":[],"readme":"## mstore [![Build Status](https://travis-ci.org/dalmatinerdb/mstore.svg?branch=master)](https://travis-ci.org/dalmatinerdb/mstore)\n\nMStore is a experimental metric store build in erlang, the primary functions are `open`, `new`, `get` and `put`.\n\nA datastore is defined by:\n * The size of the consistant hashing ring.\n * The number of entreis per metrics.\n * The initial offset.\n\nFor 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.\n\nFor 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.\n\n## Idea\n\nThe basic idea is to take advantage of the special characteristics metrics have and modern filesystems. The following assumptions about metrics and filesystems are taken:\n\n* Metrics occour in a regular interval (i.e. every second) skips happen but are rare\n* Metrics are immutable. (i.e. once the cpu temperature was recorded for a measurement period it won't ever change again).\n* Reads are highly sequential, 'give me the values between X and Y'.\n* Metrics are written nearly sequentially, the delta of time between two metrics written will propably be small, this allows to limit the amount of open files.\n* Metrics can be represented as 64bit integers. (this might change!)\n* The filesystem uses checksums for data, this means we don't need to cehcksum values.\n* The filesystem allows compression. This means longer stratches of non written metrics don't have a big impact since a bunch fo 0's on the FS will easiely be compressed away.\n* The filesystem has a decent cacheing strategy (no need for mmap nonsense).\n* The filesystem actually is ZFS.\n\n## File Layout\n\n### Set\n\nA set allows to group metrics into a hash ring, this limits the size of single files open. The directory layout will be like this:\n\n```\n\u003cbase dir\u003e/\u003cchash key\u003e/\u003coffset\u003e.{mstore,idx} - data and store index files\n\u003cbase dir\u003e/mstore - set index file\n```\n\n#### Index File (for a set)\n\nThe index file is simply a Erlang file that can be read via consult:\n\n```\n{FileSize, CHashSize, Seed, Metrics}.\n```\n* FileSize: The number of points per metric stored in the file.\n* CHashSize: The number of elements in the CHash ring.\n* Seed: A seed used to hash the metric keys, this is needed to allow putting a set behind another CHash ring (i.e. riak core). W/o the seed the distribution would not be even.\n* Metrics: A list of all metrics stored in this set, used for looking up metrics.\n\n### Store\n#### Data File\n\nCurrently data is fixed to 64 bit (8 byte) integers this means a data file is layed out like this:\n\n```\n\u003cmetric 1:FileSize*8\u003e\u003cmetric 2:FileSize*8\u003e\u003cmetric 2:FileSize*8\u003e\n```\n\n#### Index File (for a metric)\n\nThe index file is simply a Erlang file that can be read via consult:\n```\n{Offse, FileSize, [{Metric, Index}]}.\n```\n\n* Offset: the base offset of the file.\n* FileSize: The number of points per metric stored in the file.\n* Metric and Index: A list of metricses and their indexes in the file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalmatinerdb%2Fmstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalmatinerdb%2Fmstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalmatinerdb%2Fmstore/lists"}