Evaluating Server-side Swift: A Performance-Focused Web Framework Comparison
2025 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE credits
Student thesisAlternative title
Utvärdering av Swift på Serversidan : En Jämförelse av Webbramverk med Fokus på Prestanda (Swedish)
Abstract [en]
Swift is a modern programming language developed by Apple, predominantly known for its extensive use in client-side applications across Apple’s ecosystem. As Swift expands into the realm of server-side development, it leverages web frameworks to enable developers to efficiently develop web services and APIs. However, a lack of up-to-date performance benchmarks creates uncertainty for its adoption. This thesis addresses this gap by evaluating the performance of Swift’s flagship web framework, Vapor, against two prominent alternatives: Kotlin’s Ktor and JavaScript’s Express. This research is crucial given Swift’s growing server-side support and the significant impact language and framework choices have on application performance and operational costs. A quantitative benchmarking methodology was employed, implementing four distinct workload scenarios (static file serving, JSON processing, database interaction, and CPU-intensive calculation) across all three frameworks. These were deployed as isolated Docker services on identical hardware and load-tested with JMeter, with key metrics such as throughput, latency, and resource utilization systematically recorded. The findings revealed no single universally superior framework, but highlighted distinct performance profiles. Vapor distinguished itself with exceptional memory efficiency and strong performance in CPU- and database-intensive tasks, with zero errors and stable latencies. While Ktor achieved the highest throughput for static content and JSON tasks, it suffered considerable performance issues and errors during database interactions. Express offered balanced performance, but was notably less efficient in CPU-intensive computations and overall memory usage compared to Vapor. This research concludes that Swift’s Vapor is a highly resource-efficient and viable option for server-side development, especially for applications demanding low memory overhead. The empirical data provides a foundation for organizations to make informed decisions regarding technology adoption, and offers objective performance insights to the broader software engineering community, clarifying Swift and Vapor’s position in the competitive landscape of web server technologies.
Abstract [sv]
Swift är ett modernt programmeringsspråk utvecklat av Apple, framför allt känt för dess omfattande användning i klientapplikationer inom Apples ekosystem. När Swift expanderar till webbserverapplikationer förlitar det sig på webbramverk för att möjliggöra effektiv utveckling av webbtjänster och API:er. Bristen på aktuella prestandajämförelser skapar dock osäkerhet kring dess användning. Denna uppsats adresserar detta genom att utvärdera prestandan hos Swifts ledande webbramverk, Vapor, mot Kotlins Ktor och JavaScripts väletablerade webbserverramverk Express. Denna forskning är viktig med tanke på Swifts växande stöd på serversidan, samt den betydande inverkan språk- och ramverksval har på applikationsprestanda och driftskostnader. De tre ramverken testades i fyra typiska serveruppgifter: överföring av simpelt webbinnehåll, JSON-bearbetning, databasinteraktion, och intensiva processorberäkningar. Testerna utfördes i isolerade miljöer på identisk hårdvara under olika simulerade belastningsnivåer. Utifrån testerna mättes hanterad arbetsmängd, svarstider, samt förbrukning av hårdvaruresurser. Resultaten visade att inget enskilt ramverk var bäst i alla lägen. Vapor var särskilt minnessnålt, presterade bäst vid processorintensiva uppgifter och databashantering, samt var i helhet stabil och felfri. Ktor klarade att hantera högst arbetsmängd för enklare webböverföringar och JSON-data, men hade stora prestandaproblem vid databasinteraktioner. Express visade balanserad prestanda, men var märkbart mindre effektiv vid processorintensiva beräkningar och i minnesanvändning jämfört med Vapor. Slutsatsen är att Swifts Vapor är ett högpresterande och resurseffektivt alternativ för serverutveckling, särskilt för applikationer som kräver låg minnesanvändning. Resultaten ger organisationer ett konkret underlag för beslut om Swift på serversidan, och erbjuder en objektiv prestandainsikt till mjukvaruutvecklingsgemenskapen, vilket möjliggör en tydligare förståelse för Swift och Vapors position gentemot konkurrerande webbserverteknologier.
Place, publisher, year, edition, pages
2025. , p. 76
Series
TRITA-EECS-EX ; 2025:393
Keywords [en]
Server-side Swift, Vapor, Ktor, Express.js, Web server framework evaluation, Performance benchmarking
Keywords [sv]
Swift på serversidan, Vapor, Ktor, Express.js, Utvärdering av Webbserverramverk, Prestandatestning
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:kth:diva-367785OAI: oai:DiVA.org:kth-367785DiVA, id: diva2:1986250
External cooperation
Framna Sweden AB
Supervisors
Examiners
2025-08-102025-07-302025-08-10Bibliographically approved