Applying event-driven architecture in a large-scale logistics system
No Thumbnail Available
URL
Journal Title
Journal ISSN
Volume Title
Perustieteiden korkeakoulu |
Master's thesis
Authors
Date
2023-08-21
Department
Major/Subject
Computer Science
Mcode
SCI3042
Degree programme
Master’s Programme in Computer, Communication and Information Sciences
Language
en
Pages
42
Series
Abstract
This thesis investigates the transition from traditional monolithic software architectures to event-driven models, emphasising their influence over system performance, scalability, and maintainability. A case study transitioning a large-scale logistics system to use event-driven architecture was conducted as a part of the thesis. The problem explication identified several problems inherent in the current system, including a shared database and the complexity of the existing codebase, largely due to technical debt accumulated over years of operation, which is common in long-lived projects. To address these challenges, an artefact was designed that applies an event-driven architectural approach. The artefact is responsible for managing the state of the deliveries, which is a central aspect of the logistics platform. Within the artefact, deliveries were modelled as state machines, with state updates managed through discrete events. This design choice enabled quick access and modification of the state data, improving the overall system performance. Apache Kafka was chosen as the event streaming platform. One of the significant challenges faced during this transformation was the integration of the new artefact into the existing system. A migration plan was formulated where initially only direct write queries related to the delivery state were replaced with events. A temporary service was created to ensure synchronization between the new artefact and the shared database, allowing the query of the delivery state from both the shared database and the event stream produced by the artefact. This approach facilitated a phased refactoring process, minimizing disruption to the existing services while enabling a gradual and controlled transition. Event-driven architecture turned out to be successful for this use case in terms of scalability and reduction of technical debt. The practical implementation posed challenges, and a good understanding of the underlying business domain for modelling the events and early and effective communication among stakeholders were crucial for the process.Tämä työ tutkii siirtymistä perinteisistä monoliittisista ohjelmistoarkkitehtuureista tapahtumapohjaisiin arkkitehtuureihin, painottaen niiden vaikutusta järjestelmän suorituskykyyn, skaalautuvuuteen ja ylläpidettävyyteen. Osana työtä toteutettiin tapaustutkimus, jossa suuren mittakaavan logistiikkajärjestelmä siirrettiin käyttämään tapahtumapohjaista arkkitehtuuria. Ongelman määrittely paljasti useita ongelmia nykyisessä järjestelmässä, mukaan lukien jaetun tietokannan käyttö ja koodikannan monimutkaisuus, joka johtuu suurelta osin teknisestä velasta, joka on kertynyt vuosien kehityksen aikana, mikä on yleistä pitkäikäisissä projekteissa. Näiden haasteiden ratkaisemiseksi suunniteltiin artefakti, joka soveltaa tapahtumapohjaista arkkitehtuuria. Artefakti on vastuussa toimitusten tilan hallinnasta, mikä on keskeinen osa logistiikkajärjestelmää. Artefaktissa toimitukset mallinnettiin tilakoneina, joiden tilapäivitykset mallinettiin tapahtumina. Tämä suunnitteluratkaisu mahdollisti tilatiedon nopean haun ja muokkaamisen, parantaen koko järjestelmän suorituskykyä. Apache Kafka valittiin alustaksi tapahtumien hallinnointiin. Yksi merkittävistä haasteista tämän työn aikana oli uuden artefaktin integroiminen olemassa olevaan järjestelmään. Tätä varten laadittiin muutossuunnitelma, jossa aluksi vain suoraan kuljetuksen tilaa muokkaavat tietokantakyselyt korvattiin tapahtumilla. Väliaikainen palvelu luotiin varmistamaan synkronointi uuden artefaktin ja yhteisen tietokannan välillä, mahdollistaen toimitustilan kyselyn sekä yhteisestä tietokannasta että artefaktin tuottamasta tapahtumavirrasta. Tämä lähestymistapa helpotti vaiheittaista refaktorointiprosessia minimoiden häiriöt olemassa oleviin palveluihin samalla kun mahdollistettiin asteittainen ja hallittu siirtymä. Tapahtumapohjainen arkkitehtuuri osoittautui menestyksekkääksi tässä käyttötapauksessa skaalautuvuuden ja teknisen velan vähentämisen suhteen. Käytännön toteutuksessa ilmeni haasteita, joiden ratkaisemiseen hyvä ymmärrys liiketoimintalogiikasta tapahtumien mallintamiseksi sekä aikainen ja tehokas viestintä sidosryhmien kesken olivat ratkaisevia.Description
Supervisor
Haaranen, LassiThesis advisor
Rao, BalajiKeywords
event-driven architecture, state management, Apache Kafka, event sourcing