Analys av cacheprestanda och TTL-strategier i mikrotjänstarkitekturer
2025 (Swedish)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE credits
Student thesisAlternative title
Analysis of Cache Performance and TTL Strategies in Microservice Architectures (English)
Abstract [sv]
I moderna webbsystem byggda med mikrotjänster är effektiv cachehantering avgörande för att minimera svarstider, nätverkstrafik och CPU-belastning. En vanlig metod är att använda en livslängdsparameter (TTL) för att styra hur länge data sparas icacheminnet, men statiska TTL-värden kan skapa problem om de inte anpassas efterförändrade åtkomstmönster. Detta examensarbete undersöker hur olika TTL-strategier påverkar API-prestanda och resursanvändning i en mikrotjänstliknande miljö.Fyra olika strategier implementerades och jämfördes: statisk TTL, belastnings- ochinnehållsbaserad TTL, sliding window TTL samt en hit-rate-baserad TTL. Resultatenvisar att statisk TTL gav högst cacheträffprocent och stabila svarstider i en relativtförutsägbar miljö, medan adaptiva strategier presterade bättre vid varierande trafikgenom att justera TTL-värden och därmed förbättra cacheeffektiviteten. Slutsatsenär att valet av TTL-strategi bör anpassas efter systemets specifika krav på prestanda,flexibilitet och resursutnyttjande.
Abstract [en]
In modern web systems built with microservices, efficient cache management is crucial for minimizing response times, network traffic, and CPU load. A commonmethod is to use a time-to-live (TTL) parameter to control how long data is stored inthe cache, but static TTL values can create problems if they are not adapted to changing access patterns. This thesis investigates how different TTL strategies affect APIperformance and resource usage in a microservice-like environment. Four differentstrategies were implemented and compared: static TTL, load- and content-basedTTL, sliding window TTL, and hit-rate-based TTL. The results show that static TTLachieved the highest cache hit rate and stable response times in a relatively predictable environment, while adaptive strategies showed potential in more dynamic traffic patterns. The conclusion is that the choice of TTL strategy should be adapted tothe system’s specific requirements for performance, flexibility, and resource utilization.
Place, publisher, year, edition, pages
2025.
Series
TRITA-CBH-GRU ; 2025:103
Keywords [en]
Adaptive TTL, Cache hit rate, Cache management, CPU load, K6 load testing, Latency, Microservice architecture, Performance testing, Redis, REST API, Static TTL, Time-To-Live (TTL)
Keywords [sv]
Adaptiv TTL, Cacheträffsfrekvens, Cachehantering, CPU-belastning, K6 belastningstest, Latens, Mikrotjänstarkitektur, Prestandatestning, Redis, REST-API, Statiskt TTL, Time-To-Live (TTL)
National Category
Software Engineering
Identifiers
URN: urn:nbn:se:kth:diva-364367OAI: oai:DiVA.org:kth-364367DiVA, id: diva2:1967553
Educational program
Bachelor of Science in Engineering - Computer Engineering
Supervisors
Examiners
2025-06-122025-06-112025-06-12Bibliographically approved