Digitala Vetenskapliga Arkivet

Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Leveraging Cosmos DB for Publish/Subscribe in KnightBus: Analyzing Cosmos DB Performance Trade-offs and Guarantees
KTH, School of Electrical Engineering and Computer Science (EECS).
2025 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesisAlternative title
Cosmos DB för Publish/Subscribe-kommunikation i KnightBus : Analys av prestandaavvägningar och garantier med Cosmos DB (Swedish)
Abstract [en]

Publish/Subscribe (Pub/Sub) is a design pattern widely used in modern communication, mainly for its ability to decouple producers and consumers. However, there is no one-size-fits-all design. Each implementation comes with a set of strengths and trade-offs, and selecting the most suitable implementation, therefore, depends entirely on the specific characteristics and requirements of the system. There is a lack of comparative performance studies between pub/sub implementations, a gap that is addressed by evaluating the performance of three Pub/Sub implementations within the open-source framework KnightBus. A novel transport based on Azure Cosmos DB was developed and benchmarked against existing implementations based on Azure Service Bus and PostgreSQL, with a focus on comparing throughput and publish latency across varied workloads, subscription patterns and operational conditions. Results demonstrate that Cosmos DB consistently achieves the highest cost-normalised throughput. Cosmos’ throughput also remains stable regardless of subscriber count. In contrast, the throughput degraded with the number of subscribers in the other transports. In latency benchmarks, PostgreSQL outperforms Cosmos and the Service Bus by a factor of two when publishing 1000 events to a node in Sweden. Conversely, Cosmos exhibits significantly faster publish times than the other two transports when publishing 1000 events to a node in New Zealand, explained by its multi-region write capabilities. For high-volume event publishing, PostgreSQL is consistently faster than the other implementations, regardless of node location. These results help guide developers choose a Pub/Sub transport tailored to their application’s specific needs. For applications with a high number of subscribers or requirements for event retention, Cosmos offers a scalable and cost-efficient solution. Conversely, PostgreSQL should be considered for applications prioritising low latency for bulk publishing.

Abstract [sv]

Publicera/prenumerera (Publish/Subscribe eller Pub/Sub) är ett designmönster som används flitigt I modern kommunikation, främst på grund av dess förmåga att separera producenter och prenumeranter. Det finns dock ingen universallösning utan varje implementation has sina styrkor och svagheter. Vilken implementation som är bäst lämpad beror därför helt på det specifika systemets egenskaper och krav. Det är väldigt begränsat med studier som jämför prestanda mellan olika implementationer, något denna studie behandlar genom att utvärdera tre implementationer i öppna ramverket KnightBus. En ny transport baserad på Azure Cosmos DB utvecklades och jämfördes med befintliga implementationer baserade på Azure Service Bus och PostgreSQL, med fokus på genomströmmning och publiceringslatens under varierade förhållanden. Resultaten visar att Cosmos konsekvent uppnår den högsta genomströmmingen samt att Cosmos genomströmming är stabil oberoende av antal prenumeranter på ämnet. Detta till skillnad från de andra transporterna där genomströmningen minskar i takt med att antalet prenumeranter ökar. I latenstester där databasen är i Sverige är PostgreSQL snabbare än både Cosmos och Service Bus oavsett antal publicerade händelser. När databasen är placerad i Nya Zeeland visar Cosmos betydligt mindre latens än dem andra transporterna vid publicering av 1000 händelser, vilket kan förklaras med dess möjlighet att skriva till flera regioner i kombination med den sekundära regionen i Sverige. Vid publicering av mer än 1000 händelser är PostgreSQL snabbast även med databasen i Nya Zeeland. Dessa resultat vägleder utvecklare i valet av pub/sub transport anpassad till applikationers specika behov. För applikationer med många prenumeranter eller krav på möjlighet till retroaktiva premenuationer erbjuder Cosmos en skalbar och kostnadseffektiv lösning. För applikationer där låg latens vid masspublicering är viktigast är PostgreSQL lämpligare.

Place, publisher, year, edition, pages
2025. , p. 41
Series
TRITA-EECS-EX ; 2025:483
Keywords [en]
Publish/Subscribe, KnightBus, Cosmos DB, Service Bus, PostgreSQL, Benchmark
Keywords [sv]
Publicera/prenumerera, KnightBus, Cosmos DB, Service Bus, PostgreSQL, systemtest
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:kth:diva-368124OAI: oai:DiVA.org:kth-368124DiVA, id: diva2:1987380
External cooperation
BookBeat
Supervisors
Examiners
Available from: 2025-08-11 Created: 2025-08-06 Last updated: 2025-08-11Bibliographically approved

Open Access in DiVA

fulltext(582 kB)153 downloads
File information
File name FULLTEXT01.pdfFile size 582 kBChecksum SHA-512
5deac8ecdcc4626616215ddcaa05f9ea0b35856db99bd490e4c69e759808acb2d368bf950dad8d2153d276e668848c6e5ff4da5ddc25828d56f0c70c26f84dd0
Type fulltextMimetype application/pdf

By organisation
School of Electrical Engineering and Computer Science (EECS)
Computer and Information Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 155 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 482 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf