A comprehensive guide to implementing Netflix Hollow for efficient data distribution across microservices. Learn how to build a production-ready system with monitoring, containerization, and performance optimization.
Get the full implementation with all configurations and examples
π GitHub Repository
https://github.com/fxellence-dev/rawhollow-demo
This project demonstrates a complete end-to-end implementation of Netflix Hollow - a Java library for disseminating in-memory datasets. The demo showcases a real-world scenario where a movie catalog service publishes data that multiple consumer services can efficiently read without database queries.
Netflix Hollow is an open-source Java library designed for efficiently disseminating large, read-heavy datasets from a single producer to many consumers. It was created at Netflix to solve the problem of distributing reference data (like movie catalogs, user preferences, configuration data) to thousands of microservices.
One service publishes data, many services consume it
Efficient incremental updates
Data is loaded into memory for ultra-fast access
Generated code provides compile-time safety
Uses pluggable blob stores (filesystem, S3, etc.)
Modern microservices architectures often face the challenge of sharing reference data efficiently:
Approach | Pros | Cons |
---|---|---|
Shared Database | Simple, consistent | Bottleneck, coupling, latency |
REST APIs | Decoupled | Network calls, latency, availability |
Message Queues | Async, decoupled | Complex state management |
Distributed Cache | Fast access | Cache invalidation complexity |
Hollow solves these problems by:
Get the Netflix Hollow demo running in under 5 minutes:
Our demo implements a Movie Catalog Distribution System where:
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ β Producer β β Blob Storage β β Consumer β β Service βββββΆβ (Filesystem) ββββββ Services β β β β β β β β βββββββββββββββ β β ββββββββββββββββ β β βββββββββββββββ β β βMovie Catalogβ β β β Snapshots β β β βMovie Queriesβ β β βManagement β β β β + Deltas β β β β& Analytics β β β βββββββββββββββ β β ββββββββββββββββ β β βββββββββββββββ β βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ β β β β β β βΌ βΌ βΌ βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ β Prometheus β β Grafana β β Load Testing β β Metrics β β Dashboards β β Scripts β βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Port: 8080
Technology: Spring Boot 3.1.0 + Netflix Hollow 7.0.2
Responsibilities:
Port: 8081
Technology: Spring Boot 3.1.0 + Hollow Consumer
Responsibilities:
Prometheus: Metrics collection
Grafana: Visualization and alerting
Features:
Producer β Generate Snapshot β Store in Blob β Announce Version
Producer β Generate Delta β Store in Blob β Announce New Version
Consumer β Check Version β Download Delta β Apply Changes β Update Queries
Our movie catalog consists of three main entity types:
// Movie entity with comprehensive attributes public class Movie { private int id; private String title; private String genre; private double rating; private int releaseYear; private String director; private String description; }
// Genre reference data public class Genre { private int id; private String name; private String description; }
// Rating aggregation data public class Rating { private int movieId; private double averageRating; private int reviewCount; private double imdbRating; }
The Hollow schema defines how data is serialized and versioned:
@HollowPrimaryKey(fields="id") public class Movie { int id; String title; String genre; double rating; int releaseYear; String director; String description; } @HollowPrimaryKey(fields="id") public class Genre { int id; String name; String description; } @HollowPrimaryKey(fields="movieId") public class Rating { int movieId; double averageRating; int reviewCount; double imdbRating; }
@Configuration public class HollowConfig { @Bean public HollowProducer hollowProducer() { return HollowProducer.withPublisher(blobPublisher()) .withBlobStager(new HollowFilesystemBlobStager( Paths.get("/app/shared-data"))) .withListener(new ProducerMetricsListener()) .withNumStatesBetweenSnapshots(10) .build(); } }
@Configuration public class HollowConsumerConfig { @Bean public HollowConsumer hollowConsumer() { return HollowConsumer.withBlobRetriever(blobRetriever()) .withListener(new ConsumerMetricsListener()) .withRefreshIntervalMs(30000) .build(); } }
# Producer Service SPRING_PROFILES_ACTIVE: docker HOLLOW_BLOB_PATH: /app/shared-data SERVER_PORT: 8080 # Consumer Service SPRING_PROFILES_ACTIVE: docker HOLLOW_BLOB_PATH: /app/shared-data SERVER_PORT: 8081 # Monitoring PROMETHEUS_RETENTION: 15d GRAFANA_ADMIN_PASSWORD: hollow123
# Producer application-docker.properties management.endpoints.web.exposure.include=* management.endpoint.health.show-details=always management.metrics.export.prometheus.enabled=true # Consumer application-docker.properties hollow.consumer.refresh-interval-ms=30000 hollow.consumer.max-concurrent-updates=3 management.metrics.export.prometheus.enabled=true
# Clone and navigate to project git clone <repository-url> cd RAWHollow # Start all services ./start-docker.sh # Wait for services to be ready (about 2-3 minutes) # Check status docker-compose ps
# Build all Docker images ./build-all.sh # Or build individually cd producer-service && mvn clean package cd ../consumer-service && mvn clean package
# Start with dependency ordering docker-compose up -d prometheus grafana # Wait for monitoring to be ready sleep 30
# Start producer first docker-compose up -d producer-service # Wait for producer to be ready sleep 60 # Start consumer docker-compose up -d consumer-service
# Check all services are running docker-compose ps # Verify health endpoints curl http://localhost:8080/actuator/health curl http://localhost:8081/actuator/health
cd producer-service mvn spring-boot:run \ -Dspring-boot.run.profiles=local
cd consumer-service mvn spring-boot:run \ -Dspring-boot.run.profiles=local
The demo includes comprehensive testing covering unit tests, integration tests, and end-to-end validation.
# Run unit tests mvn test # Run specific test class mvn test -Dtest=HollowDataModelTest # Generate coverage report mvn jacoco:report
# Run integration tests mvn verify -P integration-tests # Test data consistency curl -X GET \ http://localhost:8080/api/validate/consistency # Test producer-consumer flow curl -X POST \ http://localhost:8080/api/test/end-to-end
Validate performance under various load conditions to ensure production readiness.
# JMeter load test jmeter -n -t src/test/jmeter/hollow-load-test.jmx -l results.jtl # Artillery.js quick load test artillery quick --count 100 --num 10 http://localhost:8080/api/products # Custom load test script ./scripts/load-test.sh --concurrent-users 50 --duration 300s
Pre-configured Grafana dashboards provide real-time insights into Hollow performance and system health.
# Grafana Dashboard URLs http://localhost:3000/d/hollow-overview http://localhost:3000/d/hollow-performance http://localhost:3000/d/hollow-health # Default credentials Username: admin Password: admin
Configure alerts for critical system events and performance thresholds.
# Alert Rules (Prometheus) groups: - name: hollow.rules rules: - alert: HighMemoryUsage expr: hollow_memory_usage > 0.8 for: 5m labels: severity: warning annotations: summary: "High memory usage detected" - alert: SlowQueryResponse expr: hollow_query_duration_seconds > 0.1 for: 2m labels: severity: critical
/api/products
Retrieve all products from Hollow dataset
/api/products/{id}
Get specific product by ID
/api/categories
List all product categories
/api/health
System health check and status
{ "id": 1, "name": "Premium Laptop", "description": "High-performance laptop for professionals", "price": 1299.99, "category": { "id": 1, "name": "Electronics" }, "inStock": true, "lastUpdated": "2025-09-10T10:30:00Z" }
{ "status": "UP", "timestamp": "2025-09-10T10:30:00Z", "hollow": { "dataVersion": "v1.2.3", "lastUpdate": "2025-09-10T10:25:00Z", "recordCount": 150000, "memoryUsage": "245MB" }, "database": { "status": "UP", "connectionPool": "8/10 active" } }
Admin endpoints require API key authentication
POST /api/admin/refresh
Trigger data refreshGET /api/admin/metrics
System metricsPOST /api/admin/cache/clear
Clear cacheSymptoms: Spring Boot application throws exceptions during startup
Solutions:
docker ps
docker-compose down && docker-compose up --build
Symptoms: Application consumes excessive memory, OutOfMemoryError
Solutions:
-Xmx2g -Xms1g
/api/admin/metrics
Symptoms: API responses taking longer than expected
Solutions:
# Check application logs docker-compose logs -f hollow-demo # Monitor system resources docker stats # Check database connectivity docker exec -it postgres_db psql -U hollow_user -d hollow_db # Verify Hollow data integrity curl -X GET http://localhost:8080/api/admin/validate # Debug memory usage jmap -histo <java_process_id> # Profile application performance java -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar app.jar
netflix-hollow
This comprehensive Netflix Hollow end-to-end demo showcases the power of in-memory data management for high-performance applications. By following this guide, you've learned how to:
Netflix Hollow provides a powerful foundation for building scalable, high-performance data systems. This demo serves as a starting point for implementing Hollow in your production environments.
Complete source code available on GitHub:
https://github.com/fxellence-dev/rawhollow-demo