\chapter{Introduction}

%\chapter*{Introducere}
\label{intro}


\section{Background: The Ascendancy of Microservices in Distributed System Design}
\label{sec:ch1sec1}

\par The landscape of software architecture has undergone a significant transformation over the past decade, marked by a discernible shift from monolithic application designs towards microservice architectures. This paradigm shift is driven by the escalating demands of modern digital enterprises for increased agility, faster development cycles, independent deployability of components, and the flexibility to utilize diverse technology stacks for different functionalities. Monolithic systems, characterized by a single, large codebase where all functionalities are tightly coupled, often struggle to meet these demands, particularly in terms of scaling specific parts of an application or adopting new technologies without impacting the entire system. Microservices address these limitations by decomposing applications into a collection of small, autonomous services, each responsible for a specific business capability. \cite{fowler2014microservices} \cite{richardson2018microservices} \cite{evans2003domain} This architectural style inherently leads to distributed systems, as services typically run in separate processes and communicate over a network.

\par The adoption of microservices is not merely a technical trend but a strategic response to the need for systems that can evolve rapidly and scale efficiently. Enterprises such as Netflix and Amazon have famously transitioned to microservices to enhance their scalability, foster innovation, and ensure long-term growth. \cite{shekhar2024microservices} \cite{walia2025leveraging} However, the very nature of microservices introduces a new set of challenges. While they offer solutions to the rigidity of monoliths, their distributed characteristics bring forth complexities in managing inter-service communication, ensuring data consistency across disparate services, and maintaining overall system reliability. The independent operation of services, a key benefit, also means that the system as a whole must be resilient to failures in its individual parts. Thus, the pursuit of scalability and fault tolerance becomes a central concern in microservice design, moving beyond the capabilities offered by monolithic structures but demanding new architectural considerations.

\section{Problem Statement: The Intrinsic Scalability and Fault Tolerance Imperatives in Microservice Ecosystems}
\label{sec:ch1sec2}

\par While microservice architectures present a compelling proposition for building scalable and resilient applications, these benefits are not inherently guaranteed. The distributed and interdependent nature of microservices makes them susceptible to unique failure modes and performance bottlenecks that differ significantly from those encountered in monolithic systems. Without deliberate and sophisticated design and engineering practices, the potential advantages of microservices can be undermined by the complexities they introduce. Key challenges include the risk of cascading failures, where the failure of one service can propagate and impact dependent services, leading to widespread outages. Network latency, an unavoidable aspect of inter-service communication, can degrade performance and must be carefully managed. Ensuring data consistency across multiple, independently managed databases associated with different services is another significant hurdle. Furthermore, the operational overhead of deploying, managing, and monitoring a multitude of small services can be substantial.

\par The amplification effect of failures is a particularly critical concern. In a tightly interconnected microservice ecosystem, a seemingly minor, localized issue within a single service—such as a transient network glitch or a bug causing slow responses—can have a disproportionately large impact if not effectively isolated. This is because services often rely on other services to fulfill user requests. \cite{nygard2018release} If a downstream service becomes unresponsive or erroneous, upstream services that depend on it may also degrade or fail. This ripple effect underscores the non-negotiable requirement for robust fault tolerance strategies that go beyond simple error handling. The architectural design must inherently support the detection, isolation, and graceful handling of failures to prevent them from escalating into system-wide disruptions.

\section{Research Objectives and Guiding Questions}
\label{sec:ch1sec3}

This thesis aims to conduct a comprehensive and critical examination of the principles, patterns, technologies, and practices essential for achieving high levels of scalability and fault tolerance in microservice-based applications. The specific objectives are:
\begin{enumerate}

\item To critically evaluate existing architectural principles and design patterns that underpin scalable and fault-tolerant microservice designs.

\item To analyze the influence of different inter-service communication paradigms (e.g., synchronous RESTful APIs versus asynchronous event-driven messaging) on the system's ability to scale and tolerate faults.

\item To investigate the role of modern containerization, orchestration platforms (particularly Kubernetes)

\item To synthesize these findings into a holistic understanding of how to architect microservices that are both adaptable to varying loads and robust in the face of partial failures.

\end{enumerate}

To achieve these objectives, this research will be guided by the following key questions:

\begin{itemize}

\item What are the fundamental architectural principles that underpin scalable and fault-tolerant microservice designs?

\item How do different inter-service communication paradigms (e.g., synchronous REST vs. asynchronous messaging) influence scalability and fault tolerance?

\item Which design patterns (e.g., Circuit Breaker, Bulkhead, Retry, API Gateway, Load Balancing) are most effective in addressing specific scalability and fault tolerance challenges, and under what conditions?

\item What is the role of containerization (Docker) and orchestration platforms (Kubernetes, KEDA) in enabling dynamic scaling and resilient deployments?

\item How can chaos engineering be systematically applied to proactively identify and mitigate weaknesses in microservice resilience?

\item What are the key considerations for data management and consistency in distributed microservice environments to ensure both scalability and fault tolerance?

\end{itemize}

\section{Contributions of the Thesis}
\label{sec:ch1sec4}

This thesis endeavors to make several contributions to the understanding of scalability and fault tolerance in microservice architectures. Firstly, it will provide a synthesized framework, drawing from academic research and industry best practices, for designing microservice systems that are inherently resilient and scalable. This framework will integrate insights from foundational principles with the application of specific design patterns and enabling technologies. Secondly, the thesis will offer a comparative analysis of different technological approaches and patterns, highlighting their respective strengths, weaknesses, and optimal use contexts. This includes a nuanced discussion of communication styles, data management strategies, and resilience mechanisms. Thirdly, by integrating the concept of proactive resilience through practices like chaos engineering, the thesis aims to shift the discourse from merely reactive fault handling to a more holistic, preventative engineering approach. Finally, it seeks to identify key best practices and illuminate promising future research directions in this rapidly evolving field, leveraging insights from the provided source document  and a broader corpus of scholarly and technical literature. The overarching goal is to furnish a comprehensive, academically rigorous perspective that bridges theoretical understanding with practical application. 

\section{Thesis Structure}
\label{sec:ch1sec5}

The remainder of this thesis is organized as follows:

\begin{itemize}

\item Chapter 2 lays the theoretical foundations of microservice architecture, focusing on aspects pertinent to building resilient and scalable systems. It defines microservices, discusses their core characteristics, advantages, and disadvantages in distributed contexts, and examines critical architectural considerations such as inter-service communication and data management.

\item Chapter 3 delves into design patterns and strategies specifically aimed at achieving scalability in microservices. Topics include horizontal and vertical scaling, load balancing and API gateways.

\item Chapter 4 focuses on design patterns and strategies for enhancing fault tolerance. It covers principles like redundancy and isolation, and patterns such as Circuit Breaker, Retry and Bulkhead.

\item Chapter 5 outlines the application's microservice architecture, detailing the public e-commerce storefront for customers and the separate, secure backend for administrative inventory management.

\item Chapter 6 presents the results of a successful load test which proved the InventoryService is stable and performant, validating that its CPU-bound behavior correctly triggers the designed auto-scaling policy.

\item Chapter 7 concludes the thesis with a summary of key findings and contributions, discusses the limitations of the study, and suggests avenues for future research.

\item The Bibliography lists all cited works.

\end{itemize}