October 20, 2026
Distributed transactions with the SAGA pattern: analysis of orchestration and choreography in microservices
Distributed Transactions with the Saga Pattern: Analysis of Orchestration and Choreography in Microservices
Wanderson Xesquevixos de Siqueira; Marcelo Pereira da Silva
DOI: 10.22167/2675-6528-202602445
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
This article investigated the behavior of distributed transactions in microservice architectures through the application of the SAGA pattern, comparing orchestration and choreography approaches. The objective was to comparatively analyze these approaches in the implementation of the SAGA pattern in an experimental travel reservation system, evaluating its behavior in terms of performance and resilience. An experimental system was developed, composed of microservices implemented in Java with Spring Boot, representing customer, reservation, payment, air service, and notification domains. Two equivalent versions of the system were built, differentiated by the transactional coordination mechanism, and executed in a controlled environment through computational simulation. The research adopted a quantitative and experimental approach, collecting performance, resilience, and observability metrics, including throughput, response time, latencies, success and failure rates, execution of compensations, and mean time to recover after failures (MTTR). The results showed that choreographed SAGA presented better performance in HTTP interface latency, while orchestrated SAGA demonstrated greater operational predictability, lower recovery times, and better traceability of distributed flows. The study provided empirical evidence that highlighted the trade-offs between performance, resilience, and observability, contributing to architectural decision-making in the adoption of the SAGA pattern in distributed systems.
Keywords: Software architecture; Eventual consistency; Distributed coordination; Observability; Distributed systems.
1. Introduction
Microservices architecture has consolidated itself as an essential pillar for systems demanding high scalability, modularity, and fault tolerance (Newman, 2021; Richardson, 2020; Fowler and Lewis, 2014). The literature reinforces that this evolution allows applications to operate as autonomous and specialized services, communicating asynchronously to ensure flexibility. However, this separation introduces critical challenges in controlling data consistency, especially in operations involving large-scale distributed transactions, such as reservation and payment systems (Daraghmi, Zhang, and Yuan, 2022).
Traditionally, transactional consistency has been based on Two-Phase Commit (2PC) protocols and ACID principles, which are acronyms for Atomicity, Consistency, Isolation, and Durability. However, these mechanisms have become inadequate for highly distributed systems due to prolonged locks and low fault tolerance (Gray, 1978). In this scenario, the SAGA pattern, originally proposed by Garcia-Molina and Salem (1987), stands out by decomposing long transactions into sequences coordinated by compensatory actions. Recent studies by Bucchiarone et al. (2020) confirm that the SAGA model remains an effective strategy for ensuring eventual consistency in environments subject to failures and high latency.
Research such as that by Štefanko et al. (2019a) analyzed the application of the SAGA pattern in reactive environments, evaluating its efficiency and scalability. These authors highlighted that the SAGA pattern is a practical alternative to 2PC, capable of offering availability without completely compromising transactional integrity. However, they emphasized the absence of systematic comparative studies between orchestration and choreography styles. Complementarily, Daraghmi, Zhang, and Yuan (2022) demonstrated performance gains with the use of quota cache and eventual commit, evidencing academia’s continuous effort to balance consistency and performance.
In this context, the real-world effects of orchestration or choreography-based strategies should be examined to support the construction of resilient systems. Orchestration offers centralized control and traceability but has the potential to present single points of failure. On the other hand, choreography supports autonomy and scalability through events but presents challenges in debugging and causal ordering (Richardson, 2018, 2020). The decision between these approaches involves relative pros and cons regarding governance, service coupling, and operational complexity, thus highlighting the need for experimental analyses to understand their practical impacts (Richardson, 2020).
Even with the widespread adoption of the SAGA pattern, there are opportunities to study the methods under objective metrics such as throughput, latency, fault resilience, and observability in controlled scenarios. In the Tourism sector, this concern is especially pertinent, as reservation systems comprise several interconnected services (flights, hotels, payments) that must be reliably coordinated. Partial failures or cancellations require robust recovery mechanisms to ensure reliability for the end customer. The relevance of this work lies in the quantitative evidence that can assist software architects in decision-making when designing complex distributed systems. The objective of this work was to comparatively analyze the orchestration and choreography approaches in the implementation of the SAGA pattern through experimental analysis of a travel reservation system in microservices. The research evaluated the behavior of each approach in terms of performance and resilience.
2. Material and Methods
The research conducted was characterized as applied, with a quantitative approach and experimental nature. As discussed by Wohlin et al. (2012), experimental research in Software Engineering involves the controlled manipulation of independent variables to determine the response of dependent variables. This methodology allowed for the analysis of cause-and-effect relationships in a controlled environment, being suitable for the comparative evaluation of techniques and architectural patterns.
The work consisted of the development of an experimental reservation system based on microservices. This system was used to compare the orchestration and choreography approaches of the SAGA pattern, under the criteria of performance, consistency, and resilience. From the perspective of technical procedures, it was an experimental study with computational simulation conducted in a controlled environment.
For the system implementation, the services were developed in Java 25, using the Spring Boot 4 ecosystem. The microservices represented the functional domains of client, reservation, air, payment, and notification. Data persistence was carried out using PostgreSQL as the relational database management system.
In the orchestration approach, synchronous RESTful communication was adopted between services. In contrast, in the choreography approach, asynchronous event-driven communication was employed, using Apache Kafka as the central broker for message exchange. The choice of these technologies aligned with market trends for high-availability distributed systems (Newman, 2021; Richardson, 2020).
The experimental system was developed in two functionally equivalent versions, differing exclusively in the transactional coordination mechanism. In the orchestration-based version, the coordination of distributed transactions was centralized in an additional microservice, named Orchestrator Reserve, responsible for controlling the execution flow and compensation actions among the participating services.
In contrast, in the choreographic version, coordination occurred in a decentralized manner, through the exchange of asynchronous events between the microservices themselves, without the presence of a central component. This approach required the implementation of idempotency and event correlation mechanisms to ensure the integrity of the distributed transactional flow.
To ensure system observability, metrics collection and distributed tracing were conducted with Micrometer, Prometheus, and OpenTelemetry. Jaeger was employed for trace visualization, and the ELK stack (Elasticsearch, Logstash, and Kibana) was used for log centralization and analysis, as highlighted by Sigelman et al. (2010).
The microservices were deployed in Docker containers and orchestrated using Docker Compose, simulating a reliable and reproducible distributed environment. Each experimental scenario was executed with a fixed volume of requests and equivalent concurrency conditions, keeping infrastructure parameters, service configuration, and workload constant.
Failures were deliberately injected at specific points in the transactional flow, allowing the evaluation of sagas’ behavior under normal and adverse conditions. Load tests were conducted with the k6 tool, executed in a Docker container, used exclusively for workload generation with controlled parameters of requests and concurrency.
Performance metrics were collected independently from Prometheus and Jaeger, through automated scripts. The metrics covered throughput, p95 and p99 percentile latencies, Mean Time To Recovery (MTTR), and transactional complexity metrics proposed in this study. This approach ensured experimental reproducibility and the separation between system stimulus and observation (Wohlin et al., 2012).
The system’s reliability was evaluated by identifying success and failure flows, classifying a flow as successful when the saga was completed without the need for compensatory actions, and as failed when at least one compensation was triggered. The MTTR metric was defined as the average time between the occurrence of a failure and the completion of the last compensatory action required to restore system consistency.
Complementarily, a saga complexity metric was applied to measure the degree of difficulty associated with tracking and correlating distributed events in each approach. This score was calculated based on a normalized function that considered the number of services involved, the number of spans generated, the level of the transactional flow, and the dispersion of traces.
3. Results and Discussion
The analyzed data were collected from the experimental system’s instrumentation, using metrics extracted from Prometheus and distributed traces obtained from Jaeger. These data reflect the behavior of SAGA approaches by orchestration and choreography under controlled load and failure conditions. The analysis focused on the objective comparison between the two transactional coordination strategies, considering performance, reliability, resilience, and operational complexity metrics, according to the established methodology. The results were organized to highlight both the average behavior of the systems and their operational extremes, through the analysis of throughput, the average execution time of distributed transactions, and the latencies at the p95 and p99 percentiles.
The experimental environment was configured with microservices developed in Java 25, using Spring Boot 4. The orchestration approach employed synchronous RESTful communication, while choreography utilized asynchronous event-driven communication with Apache Kafka as the broker. The microservices were deployed in Docker containers and orchestrated by Docker Compose, with data persistence in PostgreSQL. For observability, Micrometer, Prometheus, OpenTelemetry with Jaeger for traces, and the ELK stack for logs were used, ensuring a controlled and reproducible environment for collecting performance, resilience, and observability metrics.
Load and flow metrics considered the total volume of transactions processed, represented by sagas, and the granularity of operations observed through the spans captured by distributed tracing. System reliability was assessed by identifying successful and failed flows, classifying a flow as successful when the saga was completed without the need for compensatory actions, and as failed when at least one compensation was triggered. Performance was evaluated by throughput, defined as the ratio between the total number of requests processed and the total experiment execution time, expressed in requests per second, and by the average execution time of the distributed transaction.
Latencies at the p95 and p99 percentiles were determined using the distribution of observed response times, allowing for the analysis of tail latency behavior, a critical aspect in distributed systems subject to network variability and resource contention. System resilience was assessed by analyzing executed compensations and the time required for recovery after failures. The MTTR metric was defined as the average time between the occurrence of a failure during the execution of a saga and the completion of the last compensatory action required to restore system consistency. The rate of successful compensations was estimated based on the percentage of failure flows in which all planned compensatory actions were completed without error.
Complementarily, a saga complexity metric proposed in this study was applied to measure the degree of difficulty associated with tracking and correlating distributed events in each approach. This score was calculated based on a normalized function that considered the number of services involved, the number of spans generated, the transactional flow level, and the dispersion of traces. The obtained values were placed in the range of zero to one, where higher values indicated greater operational and observability complexity. Failures were deliberately injected at specific points in the transactional flow to evaluate the behavior of the sagas under normal and adverse conditions.
SAGA Pattern Execution in Choreography
The experiments conducted for the choreography-based approach involved executing 2,000 HTTP requests, used as a load stimulus to the system. Each request represented the entry point for initiating a distributed saga, identified by the correlationId propagated between services and by analyzing the structure of distributed traces (spans). Data collection was performed from distributed traces obtained via Jaeger and metrics collected by Prometheus, within an observation window, allowing for a comprehensive view of the system’s behavior.
In the set of sagas analyzed, 1,397 resulted in the successful completion of the reservation process, while 603 culminated in failures that required the execution of compensation mechanisms. It was observed that all identified failures were correctly handled through complete compensatory flows, evidencing the consistency of the recovery mechanism adopted in the choreographed approach. This suggests that, despite the complexity inherent in decentralized coordination, the choreographed system was able to maintain transactional integrity in failure scenarios.
Regarding the input interface performance of the system, the observed average throughput was approximately 0.44 requests per second. The average latency of HTTP requests associated with the reservation service was about 3.40 ms, reflecting exclusively the time required for initial request processing and the publication of the event that initiates the saga, not representing the total runtime or completion time of the distributed flow. This value is significantly low, indicating a quick response to the user at the entry point.
The analysis of latency tails indicated values of approximately 84.60 ms for the 95th percentile and 241.96 ms for the 99th percentile, evidencing low latency in the initial response to the client. This behavior is in line with the results presented by Megargel and Poskitt (2021), who demonstrate that choreography-based architectures tend to exhibit lower average latency by eliminating central coordination points and reducing synchronous dependencies between services. Asynchronous event-driven communication, as observed by Daraghmi et al. (2022), favors lower response times in predominantly successful flows, especially in distributed systems with high autonomy among components.
The average MTTR observed was approximately 130.86 ms, considering the set of executions that required compensation. The upper percentiles indicated values of approximately 835.94 ms for the p95 and 1009.56 ms for the p99, revealing that, although most compensations occur quickly, more complex scenarios or those subject to higher load can result in longer recovery times. This increase in the average time to recovery in the choreographed approach is consistent with the observations of Štefanko et al. (2019), who point out that the absence of an explicit coordinator hinders the synchronization of compensatory actions and prolongs the system stabilization process after failures.
Similarly, Pahl and Jamshidi (2016) highlight that highly decentralized architectures depend on the correct propagation and correlation of events, which can introduce additional delays in exception scenarios and partial failures. The analysis of distributed tracing complexity demonstrated a high degree of structural standardization among the executed sagas. The normalized average complexity was 0.99, indicating low structural variability among the analyzed flows. This result stems from the observed similarity in execution flows, characterized by a consistent number of spans, services involved, and call depth.
Such results indicate that, in the adopted experimental scenario, the choreography presented a structurally uniform flow from a traceability perspective, even if distributed among multiple services. In general, the results obtained indicate that the choreography-based approach presents reduced response times at the system’s entry point, since the initial HTTP request merely triggers the distributed flow through event publication. However, the complete execution of the sagas occurs asynchronously and distributed among multiple services, which is reflected in greater variability in execution times and recovery times after failures.
These results highlight the characteristics of the decentralized coordination model adopted in choreography, in which the propagation and chaining of events between services play a central role in conducting distributed transactions. The autonomy of services in choreography, despite favoring the immediate user experience, compromises the determinism of the total business transaction time, as discussed by Richardson (2020) and Newman (2021). This characteristic is widely discussed in the literature, where Daraghmi et al. (2022) and Newman (2021) point to greater variability and duration in event-driven distributed scenarios.
SAGA Pattern in the Orchestration Approach
The SAGA pattern orchestration approach was evaluated by executing 2,000 sagas, identified through the correlationId propagated between services and by analyzing the distributed traces (spans) collected via Jaeger, within an observation window of approximately 4,582 seconds. The average processing rate observed was 0.44 sagas per second, indicating a continuous and stable flow of executions throughout the experiment. This throughput is identical to that of choreography, suggesting that both approaches maintain a similar processing capacity under continuous load.
Of the total sagas analyzed, 1,390 concluded successfully, while 610 failed, corresponding to approximately 30.5% of unsuccessful executions. In all failure cases, the compensation mechanism was triggered, totaling 610 executions of compensatory flows. The compensation rate was 30.50%, very close to the 30.15% rate observed in the choreography, indicating that the frequency of failures requiring compensation is similar between the approaches.
In terms of performance, the average end-to-end response time for sagas was 218 ms. Latency analysis revealed a p95 of 463 ms and a p99 of 1,636 ms, indicating the presence of latency tails in specific scenarios, especially in executions associated with failures and more costly compensations. These values reflect the impact of the orchestrator’s centralized control on the total processing time of distributed transactions, which, although longer at the entry point, offers greater predictability in the complete flow.
The MTTR presented an average value of 77 ms, considering the set of executions that required compensation. The p95 and p99 percentiles were 213 ms and 436 ms, respectively, demonstrating that, although most compensations are completed quickly, there are isolated cases with longer times mainly associated with scenarios involving a greater chain of compensatory operations. The greater predictability and shorter recovery time observed in the orchestrated approach reinforce the results of Richardson (2020), where the presence of a coordinating service allows for more deterministic compensatory decisions and reduces ambiguity in the execution of transactional flows.
This characteristic is also aligned with the principles defined in the MicroProfile Long Running Actions specification (Eclipse Foundation, 2023), which emphasizes the orchestrator’s role in the explicit coordination of saga steps and the ordered execution of compensation actions. The complexity of tracking sagas was evaluated through a composite score, considering the number of spans, the diversity of operations, the chaining depth, and the fan-out among the involved services. The average complexity observed was 0.974, indicating low structural variability among the executed sagas.
The most complex sagas presented multiple spans and depth of consistent execution with the architectural flow, reflecting a predominantly sequential and centralized flow, characteristic of this coordination model. This model facilitates observability and problem diagnosis, as the transactional flow is explicitly controlled by a central component. Orchestration, therefore, offers greater predictability in the execution of transactional flows and compensation mechanisms, mainly reflected in the lower variability of end-to-end latencies and the shorter recovery times observed.
Comparative Analysis between Orchestration and Choreography in the SAGA Pattern
In the context of the SAGA pattern, the comparison between orchestration and choreography approaches demonstrated remarkable characteristics in performance, fault behavior, recovery time, and distributed tracing complexity. Both approaches processed 2,000 HTTP requests and presented an average throughput of 0.44 requests per second, indicating similar continuous processing capacity within the observed experimental window. Thus, the main difference between the models did not focus on the average processing rate, but on the temporal behavior of the responses and how each architecture coordinated the complete execution of the saga.
In the analysis of HTTP latency, the choreography-based approach presented significantly superior performance. The average latency observed at the system’s entry point was 3.40 ms, lower than the value recorded in orchestration, which reached 149 ms. This difference was also maintained in the upper percentiles: while the p95 percentile was 84.60 ms in choreography and 710 ms in orchestration, the p99 percentile reached 241.96 ms and 2,124 ms, respectively. These results indicate that, in choreography, the initial response to the client occurs more quickly, as the HTTP request only triggers the publication of the saga’s initial event, reducing synchronous dependencies, as reported by Richardson (2020) and Megargel and Poskitt (2021).
However, when considering the end-to-end latency of the saga, the observed behavior was inverse. The orchestrated approach presented a lower average execution time, with 218 ms, while choreography reached 487.70 ms. This difference also became more pronounced in the upper percentiles: the p95 was 463 ms in orchestration and 2,462.45 ms in choreography, while the p99 reached 1,636 ms and 9,421.74 ms, respectively. These results show that, although choreography responds more quickly at the system’s entry point, the complete execution of the distributed transaction tends to demand more time, due to decentralized coordination and asynchronous event propagation among services.
In fault handling, this difference also manifests in the average recovery time of distributed transactions. The average MTTR observed in the orchestrated approach was 77 ms, with p95 of 213 ms and p99 of 436 ms. In choreography, the average MTTR was 130.864 ms, with p95 and p99 percentiles of 835.94 ms and 1009.559 ms, respectively. These results indicate that the presence of an explicit coordinator in orchestration favors faster execution of compensatory actions and reduces the time needed to restore system consistency after failures. This comparison illustrates that, while choreography has faster response times at the beginning of the HTTP request, fault recovery is slower and less certain compared to the orchestrated approach.
Without a central coordination point, the execution of compensations is governed by the propagation and correlation of events across multiple services, leading to a slower system recovery time after a failure. The results in recovery metrics support this difference in approaches. In terms of orchestration, MTTR was 77 ms, p95 percentiles were 213 ms, and p99 was 436 ms, reflecting that performance remained relatively stable even in failure scenarios. In choreography, an average MTTR was 130.864 ms, with p95 of 835.94 ms and p99 of 1009.559 ms, which reflects high temporal dispersion and high variability in the time required to perform compensatory actions.
In addition to performance and recovery metrics, the structural complexity of the executed sagas was also analyzed, considering factors such as the number of spans, diversity of operations, chaining depth, and fan-out between services. Regarding distributed tracing complexity, both approaches presented high scores, but with distinct structural characteristics. In orchestration, the average complexity of the sagas was 0.97, reflecting a predominantly sequential flow concentrated in a coordinating service responsible for conducting the steps of the distributed transaction. In the more complex sagas, up to nine spans and nine distinct operations were identified, which is in accordance with the architectural flow defined for the orchestrated approach.
In the choreography, the average complexity was slightly higher, reaching 0.99. In this case, the flows involved a larger number of spans distributed across multiple services and traces, albeit with less chaining depth. This behavior indicates greater structural dispersion of the transactional flow, a typical characteristic of architectures based on asynchronous event-driven communication. The higher tracking complexity observed in the choreographed approach corroborates conceptual criticisms raised by Richardson (2018), who warns about the increase in operational and cognitive cost in excessively event-driven architectures. Newman (2021) reinforces this view by arguing that, although choreography favors decoupling, it imposes additional challenges for observability and diagnostics, especially in the absence of explicit governance and distributed context correlation mechanisms.
In general, the results demonstrate a clear trade-off between the approaches. Orchestration offers greater predictability, shorter recovery time after failures, and more deterministic control of the transactional flow, in addition to presenting lower end-to-end saga latency. Choreography, in turn, provides lower latency at the HTTP request entry point, but with higher average complexity of distributed tracing. These results reflect the trade-offs described in the literature for the SAGA pattern, in which orchestration favors control and predictability, while choreography favors decoupling and responsiveness (Richardson, 2020; Newman, 2021). Choreography performs better at the HTTP request entry point, allowing for faster initial response times in success cases. However, this method also presents longer recovery times after failures and greater structural complexity for observability and incident analysis.
The results thus suggest that the choice between orchestration and choreography should consider not only isolated performance measures but also the resilience requirements, operational predictability, and observability of the distributed system. The synthesis of the results highlights the identified trade-offs between performance, operational predictability, resilience, and observability, reinforcing their implications for architectural decision-making in event-driven distributed systems. In general, the results do not indicate that one approach is truly better than the other. Performance is well-established and demonstrated, therefore, choreographed SAGA and orchestrated SAGA have complementary advantages and limitations, reflecting an intrinsic balance between performance, resilience, and observability. Thus, the choice of transactional coordination strategy should reflect the different considerations of the domain in question and the system’s architectural priorities, rather than a general approach to a better overall solution.
Specifically, the choreographed approach showed lower latency at the HTTP request entry point, while the orchestrated approach showed higher predictability in transactional flow, lower end-to-end saga latency, and faster recovery times for failure scenarios. The results obtained demonstrate that the objective of this work was fully achieved, allowing for the identification of significant differences between the approaches under the metrics of performance, resilience, and observability. The main contribution of this study is to provide concrete evidence to help software architects decide whether to adopt orchestration or choreography when implementing the SAGA pattern. The investigation carried out shows us that the decision should be based not only on isolated performance measurements but also on architectural requirements, which consider aspects such as operational predictability, resilience, and observability of the distributed system.
4. Conclusion
This study comparatively analyzed orchestration and choreography approaches in the implementation of the SAGA pattern in an experimental travel reservation system, evaluating its behavior in terms of performance and resilience. It was found that the choreographed SAGA presented lower latency at the HTTP request entry point, providing a faster initial response to the user. However, it was observed that this approach resulted in higher end-to-end latency for the complete conclusion of the distributed transaction and longer recovery times after failures, in addition to slightly higher distributed tracing complexity. In contrast, the orchestrated SAGA demonstrated greater operational predictability, with lower end-to-end saga latency and significantly shorter recovery times in failure scenarios. Although orchestration exhibited higher initial HTTP latency, it facilitated traceability and more deterministic control of transactional flows.
The main contribution of this work lies in providing concrete empirical evidence that assists software architects in decision-making when implementing the SAGA pattern, highlighting the intrinsic trade-offs between performance, resilience, and observability. The results indicate that the choice between orchestration and choreography is not based on general superiority, but rather on architectural priorities and specific domain requirements. As limitations, the use of a specific domain and the controlled experimental environment are emphasized. It is suggested that future studies explore the behavior of these approaches in alternative domains, with different load and failure profiles, and investigate hybrid designs that combine orchestration and choreography for the coordination of distributed transactions.
Bibliographic References
Bucchiarone, A., Dragoni, N., Dustdar, S., Larsen, S. T., Mazzara, M. Microservices: Science and Engineering. IEEE Software, 2020.
Daraghmi, E.; Zhang, C.-P.; Yuan, S.-M. A performance evaluation of microservices-based architectures: orchestration versus choreography. Journal of Cloud Computing, v. 11, n. 1, 2022. DOI: 10.1186/s13677-022-00299-6.
Fowler e Lewis, 2014 [Referência completa não encontrada no documento original]
Garcia-Molina, H.; Salem, K. 1987. Sagas. ACM SIGMOD Record.
Gray, J. Notes on Data Base Operating Systems. In: Operating Systems, Lecture Notes in Computer Science, 1978.
Newman, S. 2021. Building Microservices: Designing Fine-Grained Systems. (2nd ed.). O’Reilly Media.
Richardson, C. 2020. Microservices Patterns: With Examples in Java. Manning.
Štefanko, J.; Benediktsson, J.; Rysavy, O. Managing failures in microservices using the Saga pattern. In: leee International Conference On Service-Oriented System Engineering (Sose). Anais […]. IEEE, 2019. DOI: 10.
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform