Main Page: Difference between revisions
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= MemCP – A Modern In-Memory Columnar Database = | = MemCP – A Modern In-Memory Columnar Database = | ||
<div style="padding:2.5rem 2rem; margin:0 0 1.5rem; border-radius:14px; background:linear-gradient(135deg,#3d6208 0%,#64910c 52%,#76b512 100%); color:#fff; text-align:center;"> | |||
<div style="font-size:2.6rem; line-height:1.1; font-weight:700; margin-bottom:.7rem;">MemCP</div> | |||
[[ | <div style="font-size:1.45rem; line-height:1.35; font-weight:600; margin:0 auto .9rem; max-width:56rem;">A fast, compressed, MySQL-compatible columnar database for modern OLTP and OLAP workloads</div> | ||
<div style="font-size:1.05rem; line-height:1.6; margin:0 auto 1.4rem; max-width:54rem;">MemCP combines persistent in-memory operation, adaptive column compression, parallel query execution and direct application APIs in a lightweight database written in Go.</div> | |||
<div style="margin-bottom:1.5rem;"><span style="display:inline-block; padding:.2rem .65rem; margin:.15rem; border:1px solid #ffffff88; border-radius:1rem;">Beta</span> <span style="display:inline-block; padding:.2rem .65rem; margin:.15rem; border:1px solid #ffffff88; border-radius:1rem;">Open Source</span> <span style="display:inline-block; padding:.2rem .65rem; margin:.15rem; border:1px solid #ffffff88; border-radius:1rem;">MySQL Protocol + HTTP APIs</span></div> | |||
<div class="plainlinks"><span style="display:inline-block; margin:.25rem;">[[Install MemCP with Docker|<span style="display:inline-block; padding:.65rem 1rem; border-radius:6px; background:#fff; color:#496f0c; font-weight:700;">Get started with Docker</span>]]</span> <span style="display:inline-block; margin:.25rem;">[[Supported SQL|<span style="display:inline-block; padding:.65rem 1rem; border:1px solid #fff; border-radius:6px; color:#fff; font-weight:700;">Explore SQL support</span>]]</span> <span style="display:inline-block; margin:.25rem;">[https://github.com/launix-de/memcp <span style="display:inline-block; padding:.65rem 1rem; border:1px solid #fff; border-radius:6px; color:#fff; font-weight:700;">View on GitHub</span>]</span></div> | |||
</div> | |||
- | [[File:Memcp-Load.png|center|frameless|1000px|alt=MemCP database dashboard and workload overview]] | ||
= | <div style="padding:.85rem 1rem; margin:1rem 0 2rem; border-left:5px solid #d99b00; background:#fff7d6; color:#332600;"> | ||
'''Development status: Beta.''' MemCP is under active development. Check [[Supported SQL]], [[Current Status and Open Issues]] and the durability requirements of your workload before migrating production data. | |||
</div> | |||
== Choose your path == | |||
---- | <div style="display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; margin:1rem 0 2rem;"> | ||
<div style="padding:1rem 1.1rem; border:1px solid #b7c99a; border-radius:9px;"> | |||
<div style="font-size:1.15rem; font-weight:700; margin-bottom:.4rem;">Evaluate MemCP</div> | |||
Understand the workload model, current status, hardware needs and differences from MySQL. | |||
== | [[What is OLTP and OLAP|OLTP and OLAP]] · [[Comparison: MemCP vs. MySQL|Compare with MySQL]] · [[Hardware Requirements|Hardware requirements]] | ||
</div> | |||
<div style="padding:1rem 1.1rem; border:1px solid #b7c99a; border-radius:9px;"> | |||
<div style="font-size:1.15rem; font-weight:700; margin-bottom:.4rem;">Build an application</div> | |||
Use the MySQL protocol, SQL over HTTP, RDF or application-specific endpoints inside MemCP. | |||
[[Advanced SQL Tutorial|SQL tutorial]] · [[SQL over REST|SQL over HTTP]] · [[Database Tools compatibility with MemCP|Client tooling]] | |||
</div> | |||
<div style="padding:1rem 1.1rem; border:1px solid #b7c99a; border-radius:9px;"> | |||
<div style="font-size:1.15rem; font-weight:700; margin-bottom:.4rem;">Operate MemCP</div> | |||
Plan deployment, migration, persistence, storage backends, settings and performance measurement. | |||
[[Deployment]] · [[Persistency and Performance Guarantees|Durability]] · [[Migration from MySQL and PostgreSQL|Migration]] | |||
</div> | |||
<div style="padding:1rem 1.1rem; border:1px solid #b7c99a; border-radius:9px;"> | |||
<div style="font-size:1.15rem; font-weight:700; margin-bottom:.4rem;">Understand and contribute</div> | |||
Explore the storage engine, optimizer, embedded Scheme runtime and project internals. | |||
[[Query Planner and Physical Lowering|Query planner]] · [[Columnar Storage]] · [[Contributing]] | |||
</div> | |||
</div> | |||
== Quickstart == | |||
=== Run with Docker === | |||
---- | <syntaxhighlight lang="bash"> | ||
docker run --name memcp \ | |||
-e ROOT_PASSWORD='choose-a-password' \ | |||
-p 4321:4321 -p 3307:3307 \ | |||
carli2/memcp:latest | |||
</syntaxhighlight> | |||
Then open <code>http://localhost:4321</code> and connect a MySQL application to <code>127.0.0.1</code> on port '''3307'''. Add a volume mounted at <code>/data</code> when the container must retain persistent data. See [[Install MemCP with Docker|the complete Docker guide]] before deploying it as a service. | |||
=== Build from source === | |||
< | <syntaxhighlight lang="bash"> | ||
git clone https://github.com/launix-de/memcp | git clone https://github.com/launix-de/memcp | ||
cd memcp | cd memcp | ||
go | go mod download | ||
make | make | ||
./memcp --api-port=4321 --mysql-port=3307 lib/main.scm | |||
</ | </syntaxhighlight> | ||
Connect with MySQL tooling: | Connect with MySQL tooling: | ||
< | <syntaxhighlight lang="bash"> | ||
mysql -u root -p -P 3307 | mysql -h 127.0.0.1 -u root -p -P 3307 | ||
Enter password: | # Enter the password selected for this data directory. | ||
</ | </syntaxhighlight> | ||
The development default for a fresh data directory is <code>admin</code>. Change it before exposing MemCP to another machine. MemCP can also be supervised with PM2: | |||
<syntaxhighlight lang="bash"> | |||
pm2 start ./memcp --name memcp -- \ | |||
--no-repl -data ./data --api-port=4321 --mysql-port=3307 lib/main.scm | |||
</syntaxhighlight> | |||
Background deployments must use <code>--no-repl</code> so that closing standard input does not terminate the interactive console and stop the server. See [[Compile MemCP from Source|Build from Source]], [[Deployment]] and [[MemCP Console]]. | |||
== Key features == | |||
<div style="display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:.8rem; margin:1rem 0;"> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''High performance'''<br />NUMA-aware, parallelized query execution is optimized for multicore CPUs, large caches and NVMe SSDs, serving both OLTP and OLAP workloads.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Columnar storage'''<br />Data is stored by column for improved compression, a smaller memory footprint and fast analytical access.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Persistent in-memory operation'''<br />MemCP is designed to keep active data in memory while offering configurable per-table durability and persistence backends.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Built-in APIs'''<br />SQL over HTTP and in-database services can remove an extra middleware hop for suitable applications.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Adaptive compression'''<br />Bit-packing, dictionary encoding and sequence compression can reduce suitable datasets by up to 80% compared with their MySQL/MariaDB representation.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Simple deployment'''<br />Start with Docker, PM2 or the native binary. The compact application has historically had an installation footprint of approximately 10 MB.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #76b512; background:#f5f8f0; color:#17202a;">'''Extensible frontends'''<br />The Go storage engine and embedded Scheme environment support SQL, RDF, REST and custom application interfaces.</div> | |||
<div style="padding:.9rem 1rem; border-top:4px solid #9ad32d; background:#f5f8f0; color:#17202a;">'''Cost-based query execution'''<br />Logical decorrelation and join optimization are separated from cost-based physical selection of scans, indexes, RecSets, reusable caches and execution pipelines.<br />[[Query Planner and Physical Lowering|How MemCP plans and lowers queries →]]</div> | |||
</div> | |||
== Why MemCP? == | |||
Traditional relational databases were designed around spinning disks and comparatively small numbers of CPU cores. MemCP rethinks storage and query execution for modern multicore systems, large caches, fast storage and mixed workloads. | |||
Typical use cases include: | |||
* real-time dashboards and analytics; | |||
* data-heavy SaaS platforms; | |||
* embedded systems with limited resources; | |||
* high-throughput OLTP/OLAP hybrids. | |||
Whether MemCP is a good fit depends on the required SQL compatibility, durability, query mix, data size and operational environment. Review [[Supported SQL]], [[Persistency and Performance Guarantees]] and [[Performance Measurement]] rather than treating benchmark figures as universal guarantees. | |||
== MemCP vs. MySQL == | == MemCP vs. MySQL == | ||
{| class="wikitable" | {| class="wikitable" style="width:100%;" | ||
! Feature | ! Feature | ||
! MySQL | ! MySQL | ||
! MemCP | ! MemCP | ||
|- | |- | ||
| Storage | | Storage model | ||
| | | Primarily row-based | ||
| Column-based | | Column-based and compressed | ||
|- | |- | ||
| Performance | | Performance focus | ||
| | | General-purpose relational workloads | ||
| NUMA- | | NUMA-aware, in-memory execution for mixed operational and analytical workloads | ||
|- | |- | ||
| In- | | In-memory capability | ||
| | | Available through selected engines and caching | ||
| | | Central design goal and default operating model | ||
|- | |- | ||
| REST API | | REST API integration | ||
| | | Normally external | ||
| Built | | Built in | ||
|- | |- | ||
| Installation | | Installation footprint | ||
| | | Common server installations are approximately 150 MB or larger | ||
| | | The native application has historically been approximately 10 MB | ||
|- | |- | ||
| Open | | Open source | ||
| ✅ | | ✅ | ||
| ✅ | | ✅ | ||
|} | |} | ||
MemCP provides MySQL protocol compatibility but does not claim to implement every MySQL feature. See [[Comparison: MemCP vs. MySQL]] for a detailed comparison and [[Database Tools compatibility with MemCP]] for client compatibility. | |||
== Architecture overview == | |||
-- | * '''Tables, schemas and columns''': Familiar SQL structures use a compressed columnar physical layout. See [[Databases, Tables and Columns]] and [[Columnar Storage]]. | ||
* '''Transaction model''': Delta and main storage support mixed OLTP and OLAP semantics. See [[Transactions and Isolation]] and [[Shards, RecordIDs, Main Storage, Delta Storage]]. | |||
* '''Query planning''': Logical optimization is separated from physical execution decisions. See [[Query Planner and Physical Lowering]]. | |||
* '''Persistence''': Per-table durability can use filesystem, S3 or Ceph/RADOS storage. See [[Persistency and Performance Guarantees]]. | |||
* '''Frontends''': MemCP provides multiple query and application interfaces: | |||
** SQL through the MySQL wire protocol and SQL over HTTP; | |||
** an RDF/graph query frontend; | |||
** custom APIs through in-database web applications. | |||
== Documentation == | == Documentation == | ||
The following navigation remains on the start page so users and search engines can reach every major documentation area directly. | |||
=== Introduction and evaluation === | |||
* [[What is OLTP and OLAP]] | |||
* [[History of the MemCP project]] | |||
* [[Hardware Requirements]] | |||
* [[Persistency and Performance Guarantees]] | |||
* [[Current Status and Open Issues]] | |||
* [[Comparison: MemCP vs. MySQL]] | |||
=== | === Getting started === | ||
* [[Install MemCP with Docker|Install with Docker]] | |||
*[[ | * [[With Singularity|Install with Singularity/Apptainer]] | ||
*[[ | * [[Compile MemCP from Source|Build from Source]] | ||
*[[ | * [[Contributing]] | ||
*[[ | * [[Introduction to Scheme]] | ||
*[[ | * [[Full SCM API documentation]] | ||
*[[ | |||
=== Administration === | |||
* [[Deployment]] | * [[Deployment]] | ||
* [[Migration from MySQL and PostgreSQL]] | * [[Migration from MySQL and PostgreSQL]] | ||
* [[Settings]] | * [[Settings]] | ||
*[[Process Hibernation]] | * [[Process Hibernation]] | ||
*[[Performance Measurement]] | * [[Performance Measurement]] | ||
*[[MemCP Console | * [[MemCP Console]] | ||
=== Frontends === | |||
==== SQL frontend ==== | |||
* [[Supported SQL]] | |||
*[[ | * [[Advanced SQL Tutorial]] | ||
*[[ | * [[SQL over REST]] | ||
*[[ | * [[Database Tools compatibility with MemCP|Supported Tooling]] | ||
* [[How SQL Operators are implemented on MemCP]] | |||
* [[Add custom SQL operators to MemCP]] | |||
==== | ==== RDF frontend ==== | ||
*[[ | * [[Introduction to RDF]] | ||
*[[ | * [[Advanced Graph Querying]] | ||
*[[ | * [[RDF templating and model driven development]] | ||
==== | ==== Custom frontends ==== | ||
* [[In-Database WebApps|In-Database WebApps and REST Services]] | |||
* [[MemCP for Microservices]] | |||
* [[Websockets in MemCP]] | |||
=== Persistence backends and storage === | |||
* [[File System]] | * [[File System]] | ||
| Line 170: | Line 215: | ||
* [[Cluster Monitor]] | * [[Cluster Monitor]] | ||
=== Internals === | |||
==== How MemCP works ==== | |||
*[[Databases, Tables and Columns]] | * [[Databases, Tables and Columns]] | ||
*[[Shards, RecordIDs, Main Storage, Delta Storage]] | * [[Shards, RecordIDs, Main Storage, Delta Storage]] | ||
*[[Columnar Storage]] | * [[Columnar Storage]] | ||
*[[Transactions and Isolation]] | * [[Transactions and Isolation]] | ||
*[[ | * [[Query Planner and Physical Lowering]] | ||
*[[ | * [[Full SCM API documentation]] | ||
==== | ==== Scheme documentation ==== | ||
* [[SCM Builtins]] | * [[SCM Builtins]] | ||
| Line 196: | Line 241: | ||
* [[Storage]] | * [[Storage]] | ||
==== Optimizations ==== | |||
*[[In-Memory Compression, Columnar Compression Techniques]] | |||
*[[Temporary Columns]] | * [[Query Planner and Physical Lowering]] | ||
*[[Data Auto Sharding and Auto Indexing]] | * [[In-Memory Compression, Columnar Compression Techniques]] | ||
* [[Temporary Columns]] | |||
* [[Data Auto Sharding and Auto Indexing]] | |||
* [[Parallel Computing]] | * [[Parallel Computing]] | ||
== Further reading == | |||
* [https://github.com/launix-de/memcp MemCP on GitHub] | |||
* [https://www.vldb.org/pvldb/vol13/p2649-boncz.pdf VLDB Research Paper] | |||
* [https://cs.emis.de/LNI/Proceedings/Proceedings241/383.pdf LNI Proceedings Paper] | |||
* [https://www.dcs.bbk.ac.uk/~dell/teaching/cc/paper/sigmod10/p135-malewicz.pdf Large Graph Algorithms] | |||
* [https://github. | |||
* [https://www.vldb.org/pvldb/vol13/p2649-boncz.pdf VLDB Research Paper] | |||
* [https://cs.emis.de/LNI/Proceedings/Proceedings241/383.pdf LNI Proceedings Paper] | |||
* [https://www.dcs.bbk.ac.uk/~dell/teaching/cc/paper/sigmod10/p135-malewicz.pdf Large Graph Algorithms] | |||
Additional blog posts on design decisions, compression techniques and performance optimization are available on the [https://launix.de/launix/ Launix blog]. | |||
== Community == | == Community == | ||
MemCP is an open-source project maintained by developers for developers. | MemCP is an open-source project maintained by developers for developers. Contributions are welcome in the form of bug reports, feature requests and pull requests. | ||
Contributions are welcome | |||
See | See [[Contributing]] and the [https://github.com/launix-de/memcp GitHub repository]. | ||
Latest revision as of 16:23, 21 August 2026
MemCP – A Modern In-Memory Columnar Database
Development status: Beta. MemCP is under active development. Check Supported SQL, Current Status and Open Issues and the durability requirements of your workload before migrating production data.
Choose your path
Understand the workload model, current status, hardware needs and differences from MySQL.
Use the MySQL protocol, SQL over HTTP, RDF or application-specific endpoints inside MemCP.
Plan deployment, migration, persistence, storage backends, settings and performance measurement.
Explore the storage engine, optimizer, embedded Scheme runtime and project internals.
Quickstart
Run with Docker
<syntaxhighlight lang="bash"> docker run --name memcp \
-e ROOT_PASSWORD='choose-a-password' \ -p 4321:4321 -p 3307:3307 \ carli2/memcp:latest
</syntaxhighlight>
Then open http://localhost:4321 and connect a MySQL application to 127.0.0.1 on port 3307. Add a volume mounted at /data when the container must retain persistent data. See the complete Docker guide before deploying it as a service.
Build from source
<syntaxhighlight lang="bash"> git clone https://github.com/launix-de/memcp cd memcp go mod download make ./memcp --api-port=4321 --mysql-port=3307 lib/main.scm </syntaxhighlight>
Connect with MySQL tooling:
<syntaxhighlight lang="bash"> mysql -h 127.0.0.1 -u root -p -P 3307
- Enter the password selected for this data directory.
</syntaxhighlight>
The development default for a fresh data directory is admin. Change it before exposing MemCP to another machine. MemCP can also be supervised with PM2:
<syntaxhighlight lang="bash"> pm2 start ./memcp --name memcp -- \
--no-repl -data ./data --api-port=4321 --mysql-port=3307 lib/main.scm
</syntaxhighlight>
Background deployments must use --no-repl so that closing standard input does not terminate the interactive console and stop the server. See Build from Source, Deployment and MemCP Console.
Key features
NUMA-aware, parallelized query execution is optimized for multicore CPUs, large caches and NVMe SSDs, serving both OLTP and OLAP workloads.
Data is stored by column for improved compression, a smaller memory footprint and fast analytical access.
MemCP is designed to keep active data in memory while offering configurable per-table durability and persistence backends.
SQL over HTTP and in-database services can remove an extra middleware hop for suitable applications.
Bit-packing, dictionary encoding and sequence compression can reduce suitable datasets by up to 80% compared with their MySQL/MariaDB representation.
Start with Docker, PM2 or the native binary. The compact application has historically had an installation footprint of approximately 10 MB.
The Go storage engine and embedded Scheme environment support SQL, RDF, REST and custom application interfaces.
Logical decorrelation and join optimization are separated from cost-based physical selection of scans, indexes, RecSets, reusable caches and execution pipelines.
How MemCP plans and lowers queries →
Why MemCP?
Traditional relational databases were designed around spinning disks and comparatively small numbers of CPU cores. MemCP rethinks storage and query execution for modern multicore systems, large caches, fast storage and mixed workloads.
Typical use cases include:
- real-time dashboards and analytics;
- data-heavy SaaS platforms;
- embedded systems with limited resources;
- high-throughput OLTP/OLAP hybrids.
Whether MemCP is a good fit depends on the required SQL compatibility, durability, query mix, data size and operational environment. Review Supported SQL, Persistency and Performance Guarantees and Performance Measurement rather than treating benchmark figures as universal guarantees.
MemCP vs. MySQL
| Feature | MySQL | MemCP |
|---|---|---|
| Storage model | Primarily row-based | Column-based and compressed |
| Performance focus | General-purpose relational workloads | NUMA-aware, in-memory execution for mixed operational and analytical workloads |
| In-memory capability | Available through selected engines and caching | Central design goal and default operating model |
| REST API integration | Normally external | Built in |
| Installation footprint | Common server installations are approximately 150 MB or larger | The native application has historically been approximately 10 MB |
| Open source | ✅ | ✅ |
MemCP provides MySQL protocol compatibility but does not claim to implement every MySQL feature. See Comparison: MemCP vs. MySQL for a detailed comparison and Database Tools compatibility with MemCP for client compatibility.
Architecture overview
- Tables, schemas and columns: Familiar SQL structures use a compressed columnar physical layout. See Databases, Tables and Columns and Columnar Storage.
- Transaction model: Delta and main storage support mixed OLTP and OLAP semantics. See Transactions and Isolation and Shards, RecordIDs, Main Storage, Delta Storage.
- Query planning: Logical optimization is separated from physical execution decisions. See Query Planner and Physical Lowering.
- Persistence: Per-table durability can use filesystem, S3 or Ceph/RADOS storage. See Persistency and Performance Guarantees.
- Frontends: MemCP provides multiple query and application interfaces:
- SQL through the MySQL wire protocol and SQL over HTTP;
- an RDF/graph query frontend;
- custom APIs through in-database web applications.
Documentation
The following navigation remains on the start page so users and search engines can reach every major documentation area directly.
Introduction and evaluation
- What is OLTP and OLAP
- History of the MemCP project
- Hardware Requirements
- Persistency and Performance Guarantees
- Current Status and Open Issues
- Comparison: MemCP vs. MySQL
Getting started
- Install with Docker
- Install with Singularity/Apptainer
- Build from Source
- Contributing
- Introduction to Scheme
- Full SCM API documentation
Administration
- Deployment
- Migration from MySQL and PostgreSQL
- Settings
- Process Hibernation
- Performance Measurement
- MemCP Console
Frontends
SQL frontend
- Supported SQL
- Advanced SQL Tutorial
- SQL over REST
- Supported Tooling
- How SQL Operators are implemented on MemCP
- Add custom SQL operators to MemCP
RDF frontend
Custom frontends
Persistence backends and storage
Internals
How MemCP works
- Databases, Tables and Columns
- Shards, RecordIDs, Main Storage, Delta Storage
- Columnar Storage
- Transactions and Isolation
- Query Planner and Physical Lowering
- Full SCM API documentation
Scheme documentation
- SCM Builtins
- Arithmetic / Logic
- Strings
- Streams
- Lists
- Associative Lists / Dictionaries
- Date
- Vectors
- Parsers
- Sync
- IO
- Storage
Optimizations
- Query Planner and Physical Lowering
- In-Memory Compression, Columnar Compression Techniques
- Temporary Columns
- Data Auto Sharding and Auto Indexing
- Parallel Computing
Further reading
Additional blog posts on design decisions, compression techniques and performance optimization are available on the Launix blog.
Community
MemCP is an open-source project maintained by developers for developers. Contributions are welcome in the form of bug reports, feature requests and pull requests.
See Contributing and the GitHub repository.