zAuctionHouse Redis
Connect multiple servers with zAuctionHouse Redis addon
zAuctionHouse has been designed from the ground up with performance and scalability in mind. Whether you're running a small survival server or a large network like DonutSMP, zAuctionHouse is built to handle high traffic and multiple servers seamlessly.
zAuctionHouse Redis Addon
To connect multiple servers and synchronize your auction house across your entire network, you need the zAuctionHouse Redis addon.
Features
- Real-time synchronization - Items listed on one server appear instantly on all others
- Distributed locking - Prevents double purchases and race conditions
- Event propagation - All auction events (listing, purchase, removal) are synchronized
- Cache invalidation - Ensures all servers have up-to-date data
- High performance - Minimal latency impact on your servers
Why Redis?
Redis is an in-memory data structure store that provides extremely fast read and write operations. It is particularly well-suited for scenarios where multiple servers need to share and synchronize data in real time.
Performance Comparison
| Solution | Speed | Real-time Sync | Data Consistency |
|---|---|---|---|
| Redis | Extremely fast (in-memory) | Yes | Excellent |
| SQL Database | Slower (disk-based) | No | Good |
| BungeeCord/Velocity | N/A | No | N/A |
Why not SQL?
Unlike traditional SQL databases, which are disk-based and can introduce significant latency when handling frequent read and write operations, Redis operates directly in memory. This makes it ideal for applications that require high-performance, low-latency access to shared data.
Using SQL to synchronize multiple servers is not efficient for an auction house. SQL databases are designed for persistent storage, meaning each read or write operation involves disk access. This becomes a bottleneck when dealing with frequent updates from multiple servers. Additionally, SQL doesn't provide the real-time synchronization that an auction house requires, leading to delays and potential data conflicts.
zAuctionHouse still uses SQL (MySQL/MariaDB/PostgreSQL) for persistent data storage. Redis is used as a cache layer for real-time synchronization between servers.
Why not BungeeCord/Velocity messaging?
BungeeCord and Velocity are proxy solutions that facilitate communication between Minecraft servers, but they are not designed for data synchronization. While they can pass messages between servers, they lack the capability to efficiently manage shared data like auction items.
Redis, on the other hand, is designed for exactly this purpose: providing a shared, fast-access cache that multiple servers can use to ensure data consistency.
Key Benefits of Redis
- In-memory storage - Data is stored in RAM for instant access
- Pub/Sub messaging - Real-time event propagation across all servers
- Atomic operations - Prevents race conditions and data corruption
- Distributed locking - Ensures only one server can modify an item at a time
- Scalability - Handles thousands of operations per second
Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Server 1 │ │ Server 2 │ │ Server 3 │
│zAuctionHouse│ │zAuctionHouse│ │zAuctionHouse│
│+ Redis Addon│ │+ Redis Addon│ │+ Redis Addon│
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└───────────────────┼───────────────────┘
│
┌──────▼──────┐
│ Redis │
│ Server │
└──────┬──────┘
│
┌──────▼──────┐
│MySQL/MariaDB│
│ /PostgreSQL │
└─────────────┘How it works:
- Player lists an item on Server 1
- Item is saved to the shared SQL database (MySQL, MariaDB or PostgreSQL)
- Redis publishes an event to all servers
- Servers 2 and 3 receive the event and update their cache
- Players on all servers see the item instantly
Next Steps
- Installation: install Redis and configure the addon on every server
- Troubleshooting: fix connection and synchronization issues