What is Data Dragon?
Data Dragon is Riot Games’ official CDN for League of Legends static data and assets. It provides:- Item data (names, descriptions, stats, recipes)
- Champion information
- Runes and summoner spells
- Game assets (images, icons)
Crafter LoL uses Data Dragon to fetch all item information dynamically, ensuring the game stays up-to-date with the latest League of Legends patches.
API Overview
Base URL
Key Endpoints
Returns array of available patch versions.Example Response:
Returns all items for a specific version and language.Example URL:Response Size: ~500KB of JSON data
Returns item image.Example:
Spring WebClient Setup
The application uses Spring WebFlux’s WebClient for reactive, non-blocking HTTP calls.Configuration
Fromconfig/WebClientConfig.java:
Why Increase Buffer Size?
Why Increase Buffer Size?
Default Spring WebClient buffer is 256KB. Data Dragon’s Setting
item.json response is ~500KB, which would cause:maxInMemorySize to 5MB (5242880 bytes) prevents this error.Connection Timeouts
Connection Timeouts
Connect Timeout (5 seconds): Maximum time to establish connectionRead Timeout (10 seconds): Maximum time to read response dataThese values balance reliability with user experience.
Reactive vs Blocking
Reactive vs Blocking
WebClient is reactive but we use This is acceptable since:
.block() to convert to synchronous:- API calls are cached (rarely executed)
- Game endpoints are not high-throughput
Caching Strategy
Why Cache?
- Performance: Data Dragon responses are 500KB+
- Rate Limiting: Avoid hitting Riot’s rate limits
- Reliability: Game works even if Data Dragon is slow
- Cost: Reduce bandwidth usage
Caffeine Cache Configuration
Fromconfig/CacheConfig.java:
Cache Specifications
Maximum number of cache entries. Since we only cache 2 keys (
all and craftable), this is more than sufficient.Cache entries expire 24 hours after being written. This ensures:
- Daily patches get picked up automatically
- Stale data doesn’t persist indefinitely
Enables cache statistics (hit rate, miss rate, etc.) for monitoring.
Service Implementation
Fetching All Items
Fromservice/DataDragonService.java:
Filtering Craftable Items
Nested Caching:
fetchCraftableItems() calls fetchAllItems(), which also uses cache. This means:- First call to either method fetches from API
- Both caches are populated
- Subsequent calls to either method use cache
Image URL Enrichment
Data Dragon returns relative image paths:imageUrl without constructing paths.
Cache Flow Diagram
Configuration Variables
Fromapplication.properties:
Performance Metrics
First Request
~2-3 seconds (API call + processing)
Cached Request
Less than 10ms (in-memory lookup)
Response Size
500KB raw, ~200 items
Troubleshooting
DataBufferLimitException
DataBufferLimitException
Error:Solution: Increase buffer size in
application.properties:Read Timeout
Read Timeout
Error:Causes:
- Slow network connection
- Data Dragon server issues
- Timeout value too low
Cache Not Working
Cache Not Working
Symptoms: Logs show “Fetching items from Data Dragon API” on every requestChecklist:
- Verify
@EnableCachingon CacheConfig - Check
@Cacheableannotations on service methods - Ensure
spring.cache.type=caffeinein properties - Verify Caffeine dependency in pom.xml
Outdated Item Data
Outdated Item Data
Cause: League patch released but
ddragon.version not updatedSolution:- Check latest version: https://ddragon.leagueoflegends.com/api/versions.json
- Update
application.properties: - Restart application (cache will expire after 24h automatically)
Best Practices
Cache Monitoring
Enable Spring Boot Actuator to monitor cache statistics:Access metrics at:
/actuator/metrics/cache.getsNext Steps
Backend Architecture
Understand the full Spring Boot architecture
Docker Deployment
Deploy the backend in containers