GlobalProfileSync is a Java-based distributed profile synchronization system built for multi-server environments using Redis Pub/Sub, local caching, asynchronous processing, and failure fallback.
Originally developed for a distributed Minecraft network, the project addresses backend problems that are common across distributed applications: state synchronization, cache invalidation, concurrency, dependency failures, and consistency across independent instances.
- Distributed State Sync β Redis Pub/Sub propagates profile updates across independent server instances.
- Fast Local Reads β
ConcurrentHashMapprovides thread-safe in-memory caching without requiring a Redis round trip for every request. - Asynchronous Processing β
CompletableFutureandExecutorServiceisolate potentially blocking operations from latency-sensitive application threads. - Graceful Degradation β Local YAML persistence provides fallback behavior when Redis becomes temporarily unavailable.
- Dependency Injection β Core services use constructor injection instead of static global dependencies, improving testability and separation of concerns.
- Concurrent Metrics β
LongAddertracks cache hit/miss metrics with low contention. - Automated Testing β JUnit 5 and Mockito validate service logic, synchronization behavior, and failure paths.
A profile update follows an event-driven synchronization flow:
ProfileServiceupdates the shared profile state.- Redis publishes an update event.
- Other application instances receive the event.
- Their local caches are invalidated or refreshed.
- If Redis is unavailable, the persistence layer falls back to local storage.
This separates shared state synchronization from local read performance.
Redis is treated as an external dependency that can fail.
Instead of allowing a temporary Redis outage to immediately make profile operations unavailable, the system can fall back to local persistence.
The trade-off favors temporary local availability over complete service failure during dependency outages.
The system operates in a concurrent environment where multiple events and profile operations can execute simultaneously.
Key mechanisms include:
ConcurrentHashMapfor thread-safe local state;CompletableFuturefor asynchronous workflows;- controlled
ExecutorServicelifecycle; - Jedis connection pooling;
- Redis Pub/Sub for event propagation;
LongAdderfor concurrent metrics;- explicit resource cleanup during shutdown.
| Area | Technology |
|---|---|
| Language | Java 8 |
| Distributed Store | Redis |
| Redis Client | Jedis |
| Messaging | Redis Pub/Sub |
| Caching | ConcurrentHashMap |
| Concurrency | CompletableFuture, ExecutorService |
| Fallback Storage | YAML |
| Testing | JUnit 5, Mockito |
| Build | Maven |
| Runtime | OpenJDK / Amazon Corretto |
The architecture allows core behavior to be tested without requiring a live Redis instance.
Tests cover areas such as:
- profile service behavior;
- cache hit/miss scenarios;
- Redis failures;
- fallback activation;
- synchronization events;
- resource lifecycle management.
Run the test suite:
mvn test
GlobalProfileSync demonstrates practical Java engineering experience with:
Distributed Systems Β· Redis Pub/Sub Β· Event-Driven Architecture Β· Concurrency Β· Cache Invalidation Β· Asynchronous Processing Β· Graceful Degradation Β· Dependency Injection Β· Automated Testing
Although the original runtime is a multi-server game platform, the core engineering challenges are the same ones found in distributed backend systems: shared state, synchronization, concurrency, caching, consistency, and network dependency failures.