Analys av strategier för lastbalanseringi aktörsbaserade mikrotjänster: Implementering och jämförelse av två strategier i Akka Cluster Sharding medstöd för dynamisk horisontell skalning
2025 (Swedish)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE credits
Student thesisAlternative title
Analysis of load balancing strategiesin actor based microservices : Implementation and comparison of two strategies in AkkaCluster Sharding with support for dynamic horizontal scaling (English)
Abstract [sv]
I takt med att efterfrågan på skalbara mikrotjänstbaserade system ökar, växer behovet av effektiva strategier för lastbalansering. Detta arbete undersöker hur ett aktörsbaserat system för Internet of Things (IoT), utvecklat av företaget Youmoni, kan skalas horisontellt för att förbättra systemets resiliens vid nodfel och hantering av hög belastning. Målet har varit att utvärdera två strategier för intern lastbalansering i Akka Cluster Sharding: den inbyggda LeastShardAllocationStrategy och enegenutvecklad implementation kallad CPUShardAllocationStrategy.
En prototyp utvecklades baserat på Scala och Akka, där strategierna implementerades och testades i en kontrollerad miljö baserad på Docker Swarm. Last genererades med Locust, och CPU-belastning samt shard-allokering övervakades med KamonAPM.
Resultaten visar att båda strategier uppnår lastbalansering, men att CPUShardAllocationStrategy medför fler ombalanseringar och högre overhead, särskilt vid små variationer i belastning. LeastShardAllocationStrategy presterade mer stabilt och bedömdes som mer effektiv i applikationer med jämn arbetsbörda. Slutsatsen är att strategi bör väljas utifrån belastningsmönster och krav på precision i resursfördelning.
Abstract [en]
As the demand for scalable microservice-based systems increases, so does the need for effective load balancing strategies. This work investigates how an actor-based Internet of Things (IoT) system, developed by the company Youmoni, can be horizontally scaled to improve system resilience in the event of node failures and to handle high loads. The goal has been to evaluate two internal load balancing strategies within Akka Cluster Sharding: the built-in LeastShardAllocationStrategy and a custom implementation named CPUShardAllocationStrategy.
A prototype was developed using Scala and Akka, where both strategies were implemented and tested in a controlled environment based on Docker Swarm. Load was generated using Locust, and CPU usage along with shard allocation were monitored with Kamon APM.
The results show that both strategies achieve load balancing, but CPUShardAllocationStrategy results in more rebalancing and higher overhead, particularly under small variations in load. LeastShardAllocationStrategy performed more consistently and was deemed more effective for applications with evenly distributed workloads. The conclusion is that the choice of strategy should be based on the system’s load patterns and precision requirements for resource distribution.
Place, publisher, year, edition, pages
2025.
Series
TRITA-CBH-GRU ; 2025-093
Keywords [en]
Load balancing, Horizontal scaling, Akka, Cluster Sharding, CPU load, Microservices, Docker Swarm, Locust, Kamon, IoT
Keywords [sv]
Lastbalansering, Horisontell skalning, Akka, Cluster Sharding, CPU-belastning, Mikrotjänster, Docker Swarm, Locust, Kamon, IoT
National Category
Software Engineering
Identifiers
URN: urn:nbn:se:kth:diva-364286OAI: oai:DiVA.org:kth-364286DiVA, id: diva2:1966142
Subject / course
Computer Technology, Program- and System Development
Educational program
Bachelor of Science in Engineering - Computer Engineering
Supervisors
Examiners
2025-06-102025-06-092025-06-10Bibliographically approved