An Introduction to Engula

Engula is a high-performance, memory-efficient database fully compatible with Redis. It is built upon the Redis Server codebase, replacing Redis’s in-memory object storage module with the Engula memory engine while maintaining full protocol compatibility. This design enables effortless migration from existing Redis deployments.

Core Design Philosophy

Engula’s architecture is guided by three fundamental principles:

  • Full Redis Compatibility – Ensures seamless migration with complete protocol alignment
  • Memory Efficiency First – Utilizes advanced compression and compact metadata encoding to minimize memory footprint
  • Response Latency Priority – Maintains sub-millisecond latency on par with Redis

Architecture Overview

Engula Server builds upon the Redis Server architecture. The primary modification involves replacing the in-memory object storage module with the Engula memory engine. Other Redis modules require only minor adaptations, preserving compatibility across all Redis functionalities.

Memory Architecture

In Redis Server, data access revolves around the Redis Object (robj). Within Engula Server, in-memory data is represented as an Engula Object (eobj), a more compact structure specifically optimized for compression and decompression efficiency.

During key-value operations, Engula Objects are dynamically converted into temporary Redis Objects through:

  • Lazy Loading – Temporary robj instances are only created on demand
  • Automatic Release – Compiler-level guarantees ensure temporary objects are properly reclaimed under all conditions

Memory Efficiency

Engula dramatically reduces memory consumption through highly optimized data structures and encoding schemes. In typical scenarios,

Data Structure Redis Overhead (Bytes) Engula Overhead (Bytes) Optimization
HashTable 32 (dictEntry) 14 Swiss table
Key + robj 3 (key sds) + 16 (robj) 10 eobj storage
Value (String) 3 (value sds) 1 eobj storage
TTL 8 5 Variable-length integer encoding
Jemalloc ≥ 4 (8-byte alignment) 2 Memory Block management
Total 66 32 ~50% memory reduction

Memory Block Management

Key-value data in Engula is stored in Memory Blocks, divided into:

  • Mutable Zone – Data can be modified
  • Immutable Zone – Data deletion only

Background tasks periodically compress and replace blocks in the Immutable Zone. These tasks are fragmented into small, interruptible coroutines, executed within native Redis main and I/O threads.

Engula dynamically adjusts response-time budgets based on system load and prioritizes foreground operations to meet latency expectations. Background workloads are intelligently distributed across I/O threads according to thread utilization to maximize CPU efficiency.

Performance and Scalability

Horizontal Scalability

Engula improves multi-core CPU efficiency compared to Redis by leveraging additional I/O threads. In multi-CPU environments, Engula delivers smoother CPU utilization and higher read/write throughput, while maintaining performance that matches or exceeds Redis.

I/O Model Optimization

Redis (Busy Polling Model)

  • Philosophy: Assumes exclusive access to CPU and memory resources
  • Mechanism: I/O threads perform busy polling (≈1 million cycles ≈ 0.1ms) before sleeping
  • Behavior: Non-linear CPU consumption under high load

Engula (Adaptive Signal/Wait Model)

  • Philosophy: Designed for resource efficiency in shared environments
  • Mechanism: Replaces busy polling with an optimized signal/wait approach using atomic ops and pthread condition variables
  • Optimization: Minimizes signal frequency and eliminates redundant context switches
  • Outcome: Achieves Redis-level peak throughput with smoother, more predictable CPU scalability

CPU–Memory Trade-off

Engula actively trades minimal CPU overhead for substantial memory savings through real-time data compression and decompression. This approach preserves performance while significantly reducing memory usage.

Compatibility with Redis® and Valkey

Engula maintains full wire protocol compatibility with both Redis and Valkey. By integrating native compute layers from these open-source ecosystems, Engula ensures consistent behavior for all standard data manipulation commands.

With a modular design focused on isolated storage integration points, Engula can align with new Redis or Valkey releases within one month, ensuring rapid compatibility updates.

Version Support

  • Redis: Up to version 7.2.4
  • Valkey: Full support across all versions
  • Ongoing Transition: Migration in progress toward Valkey 8/9

Enhanced Features

Performance Enhancements

  • Proprietary RDB Format: Reduces SAVE/LOAD times and accelerates full replication sync
  • Large Value Optimization: 50%+ read performance boost for large-value operations in multi-threaded (≥4 threads) configurations

Functional Enhancements

  • ZSet Compression: Compressed sorted sets to further reduce memory overhead
  • Enhanced Threading Model: Per-thread/per-coroutine scheduling with Redis/Valkey task prioritization for improved CPU utilization

Conclusion

Engula represents a major advancement in Redis-compatible databases, combining innovative memory management, aggressive compression, and protocol-level interoperability.

Its adaptive I/O model and horizontally scalable architecture deliver consistent, linear performance while achieving up to 50% memory reduction compared to standard Redis deployments.

Through efficient design and continuous compatibility with Redis and Valkey, Engula offers a compelling platform for organizations seeking to lower memory costs without compromising performance or compatibility.