https://github.com/aviat-at/ramdb1
ramdb is a lightweight, in-memory database built using Python's memory-mapped file capabilities.
https://github.com/aviat-at/ramdb1
cloud-computing-concepts databse devops-team opensource-projects python3 ramdb
Last synced: 4 months ago
JSON representation
ramdb is a lightweight, in-memory database built using Python's memory-mapped file capabilities.
- Host: GitHub
- URL: https://github.com/aviat-at/ramdb1
- Owner: Aviat-at
- License: mit
- Created: 2025-02-18T16:03:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-18T16:52:21.000Z (about 1 year ago)
- Last Synced: 2025-02-18T17:42:08.765Z (about 1 year ago)
- Topics: cloud-computing-concepts, databse, devops-team, opensource-projects, python3, ramdb
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ramdb
ramdb is a lightweight, in-memory database built using Python's memory-mapped file capabilities. It simulates a simple database system by loading data (e.g., from MySQL) into RAM, enabling rapid query responses and benchmarking comparisons between traditional MySQL queries and in-memory queries.
## Features
- **In-Memory Data Storage:** Utilizes a memory-mapped file to simulate a RAM database.
- **MySQL Integration:** Load data directly from MySQL tables (e.g., the departments table from an employees database) into RAM.
- **Fast Query Execution:** Offers a query engine that performs bit-address based lookups for fast data retrieval.
- **Performance Benchmarking:** Compare query execution times between MySQL and ramdb.
- **Debug and Testing Tools:** Includes scripts for testing MySQL connections, loading data, and debugging RAM storage.
- **Swap System:** Contains a simple mechanism to move data from RAM to disk (SSD) when memory is limited.
## File Overview
- **benchmark_ram_vs_mysql.py:** Benchmarks and compares the query performance of MySQL versus the in-memory ramdb.
- **test_mysql_loader.py:** Loads the departments table from MySQL into ramdb and prints all stored records for verification.
- **query_engine.py:** Provides methods for inserting and fetching records using bit-address lookup.
- **memory_manager.py:** Manages the low-level memory mapping, including allocation and fetching of records.
- **debug_ram_storage.py:** Debug utility that reloads data into ramdb and prints stored records for troubleshooting.
- **mysql_loader.py:** Connects to a MySQL database and loads selected table data into the in-memory ramdb.
- **test_mysql_connection.py:** Verifies the connection to the MySQL database and lists available tables.
- **swap_system.py:** Implements a basic swap mechanism to offload records from RAM to disk when needed.
## Installation
### Prerequisites
- Python 3.6 or higher
- MySQL Server
### Python Packages
- `mysql-connector-python`
### Setup Steps
1. **Clone the Repository:**
✅ **Engage with the open-source community** to improve RAMDB’s performance.
📢 **Want to contribute?** Check out our [GitHub Issues](#) and [Discussions](#). 🚀
```bash
git clone https://github.com/Aviat-at/ramdb.git
cd ramdb