Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianconcept/matter
Algorithmically sharded repository for Pharo.
https://github.com/sebastianconcept/matter
cache database pharo smalltalk
Last synced: 6 days ago
JSON representation
Algorithmically sharded repository for Pharo.
- Host: GitHub
- URL: https://github.com/sebastianconcept/matter
- Owner: sebastianconcept
- License: mit
- Created: 2022-10-22T18:46:05.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T11:24:54.000Z (11 months ago)
- Last Synced: 2024-12-09T14:10:00.977Z (15 days ago)
- Topics: cache, database, pharo, smalltalk
- Language: Smalltalk
- Homepage:
- Size: 623 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Matter](./header.png)
# MatterAlgorithmically sharded repository for Pharo.
![build](https://github.com/sebastianconcept/matter/actions/workflows/build.yml/badge.svg)
[![Release](https://img.shields.io/github/v/tag/sebastianconcept/matter?label=release)](https://github.com/sebastianconcept/matter/releases)
![Tests](https://img.shields.io/badge/tests-10-green)
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE.txt)[![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept)
[![Pharo 7](https://img.shields.io/badge/Pharo-7-%23aac9ff.svg)](https://pharo.org/download)
[![Pharo 10](https://img.shields.io/badge/Pharo-10-%23aac9ff.svg)](https://pharo.org/download)---
## Features
- Basic `Dictionary` API.
- Simplicity. No transactions, no persistance, just a big cache of Pharo objects.
- Horizontably scalable by adding nodes to the shard.
- No need to create and maintain schemas.
- Homogeneously distributed data load.
- Fast as a Dictionary can be.## Ambition
Matter gives you a performant cache of objects with a basic Dictionary API and scalable by the number of Pharo images configured in the clients.
## Examples
```Smalltalk
"Start 3 servers (in the same image just for testing)"
server1 := MTServer startOn: 1901.
server2 := MTServer startOn: 1902.
server3 := MTServer startOn: 1903."Stop them later"
server1 stop.
server2 stop.
server3 stop.
``````Smalltalk
"Create the client of the shard."
urls := {
'ws://localhost:1901'.
'ws://localhost:1902'.
'ws://localhost:1903'.
}.
client := Matter fromUrls: urls.
``````Smalltalk
"Add objects to the shard"
client at: #store40 put: 40.
client at: #store41 put: 41.
client at: #store42 put: 42.
``````Smalltalk
"Query objects from the shard."
found := client at: #store42.
found == 42.
``````Smalltalk
"Checking server storage's size"
(client nodes at: 'ws://localhost:1901') size == 2.
(client nodes at: 'ws://localhost:1902') size == 0.
(client nodes at: 'ws://localhost:1903') size == 1.
client size == 3.
```## Installation
Open a Pharo workspace and evaluate:
```smalltalk
Metacello new
baseline: 'Matter';
repository: 'github://sebastianconcept/matter/src';
load
```## Include as dependency
In BaselineOf or ConfigurationOf it can be added in this way:
```smalltalk
spec
baseline: 'Matter'
with: [ spec
repository: 'github://sebastianconcept/matter/src';
loads: #('Core' 'Core-Tests' 'Client' 'Server' 'Client-Tests' 'Server-Tests') ]
```## Benchmarks
Here are some benchmarks to quantify its optimization potential using the production data that ispired this work:```smalltalk
ABBench bench: [
ABBench
a: [ bench queryMongoTimes: 10000 ]
b: [ bench queryMatterTimes: 10000 ].
].
"B is 317.29% FASTER than A"
``````smalltalk
ABBench bench: [
ABBench
a: [ bench queryRedisTimes: 1000 ]
b: [ bench queryMatterTimes: 1000 ].
]."B is 191.47% FASTER than A"
```## Docker
### Image build```bash
docker build -t matter .
```
### Container run```bash
docker run --rm -e MATTER_PORT=1901 -p 1901:1901 matter
```### Cluster with docker-compose
This will start/stop a Matter cluster of 5 MTServer nodes. Starting in port 1901 and ending in 1905.
```bash
docker-compose up -d
```