Skip to content

Architecture & Tuning

Lukatrum edited this page May 13, 2026 · 2 revisions

Architecture & Performance Tuning

Configure omni-json-db to perfectly balance I/O speed, RAM usage, and disk footprint based on your specific workload.

1. Supported Data Formats (data_type)

Determines how Keys and Values are serialized.

  • J+J: JSON Key + JSON Value (Fastest write, highly readable).
  • J+S: JSON Key + MsgPack Value (Default, smallest size, faster read/write).
  • S+M: MsgPack Key + Marshal Value (Fastest read speed).
  • J+P: JSON Key + Pickle Value (Supports all Python types, but slower).

2. Supported Compression (zip_type)

Mix serialization with advanced compression algorithms.

  • no: No compression (Default, extreme speed).
  • lz: LZ4 (Fastest zip/unzip, worst compression ratio).
  • zs / z1 / z2: Zstandard (Perfect balance of ratio and speed).
  • br: Brotli (Maximum compression ratio, ideal for read-heavy workloads).
# Example: Create an ultra-compressed, read-optimized database
jdb = JDb("archive.jdb", data_type="S+S", zip_type="zs")

3. Memory Optimization (key_limit)

Adjust the internal Key Table data structure to save massive amounts of RAM.

no: Standard Python dict (Default, uses the most memory but fastest search).
bt: BTree indexing (Saves ~44% RAM compared to dict).
l0 - l5: LiteKeyTable modes (Saves 60% - 75% RAM, highly efficient for massive datasets).

Clone this wiki locally