🚀 Redis ORM Cache Integration
Transform Your Odoo Performance with Distributed Redis Caching
⚡ The Problem
Odoo's default in-memory cache creates serious challenges in both multi-worker (single server with multiple workers) and multi-instance (load balancing, horizontal scaling) environments:
- Isolated Cache Per Worker/Instance: Each Odoo worker process maintains its own isolated in-memory cache. Even on a single server with 4 workers, you have 4 separate cache stores that don't communicate with each other
- Cache Inconsistency: When Worker 1 updates data and invalidates its cache, Workers 2-4 still serve stale cached data. Users hitting different workers see inconsistent information, leading to unpredictable behavior and data integrity issues
- Database Overload: Each worker must rebuild its own cache independently, causing repeated identical queries to PostgreSQL. A query cached in Worker 1 must be re-executed in Workers 2, 3, and 4
- Limited Scalability: Adding more workers or instances doesn't improve cache efficiency—it multiplies the problem. More workers = more cache duplication = more database load
- Memory Waste: Duplicate cache data across all worker processes and servers consuming valuable RAM. With 4 workers on 3 servers, the same data is cached 12 times!
📌 Important: This issue affects ANY Odoo deployment running more than 1 worker, not just multi-server setups. Even a single Odoo server with the recommended 4-8 workers suffers from cache fragmentation and inconsistency.
✨ The Solution: Redis-Powered ORM Cache
This module seamlessly replaces Odoo's default local memory cache with a centralized Redis cache, enabling lightning-fast data access with perfect consistency across all your Odoo instances.
🎯 Key Benefits
📊 Massive PostgreSQL Load Reduction
Reduce database queries by 60-80% by serving frequently accessed ORM data directly from Redis. Your PostgreSQL server can focus on write operations and complex queries, dramatically improving overall system performance.
⚡ Blazing Fast RAM-Speed Data Access
Redis stores cache in RAM with sub-millisecond response times (<1ms). Experience 10-50x faster data retrieval compared to PostgreSQL disk I/O operations.
🔄 Perfect Data Consistency Across Workers & Instances
All Odoo workers and instances share the same centralized Redis cache. Whether you have 4 workers on one server or 10 instances in a cluster, when data changes anywhere, cache invalidation propagates instantly to all processes—eliminating stale data issues and ensuring every user sees the same up-to-date information, regardless of which worker handles their request.
📈 Unlimited Scalability (Vertical & Horizontal)
Scale up by adding more workers per server or scale out by adding more instances—without cache duplication. Each new worker or server leverages the shared Redis cache, making your infrastructure truly scalable and cost-effective. More capacity = same cache efficiency!
📊 Expected Performance Improvements
❌ Without Redis Cache
- Slower page loads due to repeated database queries
- High number of concurrent database connections
- Increased database CPU and I/O usage
- Lower cache hit rate (isolated per worker)
- ORM queries hitting disk storage
- Cache inconsistency between workers/instances
✅ With Redis Cache
- Faster page loads - RAM-speed data access 🚀
- Reduced database load - Fewer connections needed ⬇️
- Lower DB resource usage - CPU and I/O relief ✅
- Higher cache hit rate - Shared across all workers ⬆️
- Sub-millisecond queries - Direct RAM access 🎯
- Perfect consistency - Synchronized cache 🔄
💡 Performance Impact: Expect significantly faster response times and substantially reduced database load. Actual improvements vary based on your workload, data access patterns, and system configuration.
🛠️ Installation Guide
Step 1: Install Required Dependencies
Install the Redis Python client library on all Odoo servers:
pip install redis~=7.1
Step 2: Install Redis Server
If you don't have a Redis server yet, install it:
Ubuntu/Debian:
sudo apt update
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server
CentOS/RHEL:
sudo yum install redis
sudo systemctl enable redis
sudo systemctl start redis
Docker (Quick Start):
docker run -d --name redis-cache -p 6379:6379 redis:latest
Step 3: Configure Odoo
Download and extract this module to your Odoo addons directory, then add the following parameters to your
odoo.conf
file:
[options]
# Your existing configuration options...
# REQUIRED: Load this module at server startup (before database initialization)
server_wide_modules = base,web,ro_cache_redis
# REQUIRED: Redis server connection URL
redis_cache_url = redis://localhost:6379/0
# Optional: Cache expiration time in seconds (default: 3600 = 1 hour)
redis_cache_expiration = 3600
# Optional: Custom prefix for cache keys (default: odoo_orm_cache)
redis_cache_prefix = odoo_orm_cache
ℹ️ Why server_wide_modules?
This module must be loaded before Odoo initializes the database registry and cache system.
By adding it to server_wide_modules, it loads at server startup and can properly replace
the default cache implementation. Without this configuration, the module will not work.
📝 Configuration Options Explained:
| server_wide_modules |
(Required)
Must include ro_cache_redis to load the module at server startup.
Default value: base,web - Add ,ro_cache_redis to the end
|
| redis_cache_url |
(Required)
Redis connection string. Format:
redis://[user:password@]host:port/db
Examples:
|
| redis_cache_expiration |
(Optional)
Time-to-live for cache entries in seconds. Default: 3600 (1 hour)
Recommended: 3600-7200 for most cases |
| redis_cache_prefix |
(Optional)
Prefix for all cache keys. Default:
odoo_orm_cache
Useful when sharing Redis with multiple applications |
Step 4: Restart Odoo and Verify
sudo systemctl restart odoo
Check your Odoo logs for the confirmation message:
INFO: Connected to Redis cache server at redis://localhost:6379/0
⚠️ Important Notes:
-
The module will NOT work without
server_wide_modulesconfiguration! It must be loaded at server startup, not through the Apps menu. - If Redis connection fails, Odoo will automatically fall back to local in-memory cache (graceful degradation)
- Apply the same configuration to all Odoo instances/workers in your deployment to ensure they share the cache
- The module automatically handles cache serialization using pickle protocol
🎯 Perfect For
Multi-Worker Deployments
Any Odoo server running 2+ workers (the default recommended configuration)
Load Balanced Clusters
Multi-instance deployments requiring consistent cache across all servers
Enterprise Systems
Large-scale installations with thousands of concurrent users
Performance Issues
Systems with slow queries and database bottlenecks
💡 Technical Features
- ✅ Seamless Integration: Drop-in replacement for Odoo's native LRU cache—no code changes required
- ✅ Intelligent Serialization: Automatic pickle-based serialization with fallback for unpicklable objects
- ✅ Connection Resilience: Exponential backoff retry strategy with automatic failover to local cache
- ✅ Health Monitoring: Built-in connection health checks every 30 seconds
- ✅ Efficient Key Management: MD5-hashed cache keys with customizable prefixes per database and cache type
- ✅ TTL Support: Configurable expiration times with automatic key refresh on access
- ✅ Thread-Safe: All cache operations protected with locks for concurrent access
- ✅ Graceful Degradation: Continues working with local cache if Redis becomes unavailable
- ✅ Zero Maintenance: Automatic cache invalidation when data changes in the ORM
- ✅ Test Mode Compatible: Automatically disabled during Odoo test runs to prevent interference
🚀 Ready to Supercharge Your Odoo?
Stop letting database bottlenecks slow down your business. Install Redis ORM Cache today and experience the difference!
💰 Pricing: $36.99 USD (One-time payment)
Includes lifetime updates and basic email support
📞 Support & Contact
Get in Touch
Need help with installation, configuration, or have questions about the module?
Email Support:
Average response time: 24 hours
We're here to help you succeed! 🎉
Developed by TechRover
| Odoo 16.0 Compatible | Version 1.0.0
Licensed under OPL-1 (Odoo Proprietary License v1.0)
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module