Percorrer por autor "AMARAL, HUGO MIGUEL MENDES"
A mostrar 1 - 1 de 1
Resultados por página
Opções de ordenação
- Migrar aplicações REST para gRPCPublication . AMARAL, HUGO MIGUEL MENDES; Azevedo, Isabel de Fátima SilvaThe communication between services in distributed architectures in microservices has traditionally been supported by REST, due to its simplicity, generalized adoption, and easy integration with multiple platforms. However, as the systems grow in scale and complexity, relevant limitations associated with REST emerge. It is hard to impose, it is built on top of HTTP 1.X and makes use of text formats readable by humans, which is inefficient for service-to-service interactions and there’s the absence of well-defined and strongly typed service definitions. Those limitations become even clearer on systems that require high performance, low latency and strong consistency in service communication. Google’s gRPC presents an as alternative capable of filling those gaps. In particular, gRPC outperforms the traditional REST paradigm, particularly in inter-service communication within microservices architectures, in key metrics such as throughput, response time, bandwidth efficiency, and bi-directional streaming. Moreover, as gRPC uses Protocol Buffers to define services, gRPC service contracts clearly define the types that will be used for interaction between the applications. This helps in overcoming common runtime and interoperability errors that are typically faced when applications are built by multiple teams and different technologies. However, the adoption of gRPC in already developed REST systems is not a straightforward process. It involves technical and organizational challenges, which go from ensuring the compatibility of clients and servers during the transition to the lack of good practices. In addition, the information about how to effectively migrate REST applications to gRPC is extremely limited, as there is a significant gap in academic literature regarding a methodical and strategic way to perform a migration. The work’s objective, at a high level, is to explore, design and compare migration approaches of REST projects to gRPC, and implement one or more of the developed strategies, providing an extensive analysis of the results. That is achieved by delving particularly into gRPC, but also studying other frameworks, dissecting their differences and identifying their benefits and downsides and what led to their adoption. In the end, the final goal is to provide helpful insights and guidelines for engineering teams studying modernization in their communication protocols, contributing to the broader discussion about the transformation and progression of distributed systems and API architectures. For that, a systematic literature review was conducted and then complemented by an analysis of real cases in the industry, in order to identify methodologies, challenges, tools and good practices relevant for the migration process. The systematic review revealed a lack of scientific sources directly focused on a migration from REST to gRPC, with the contributions from technical blogs from companies like WePay, Google Cloud and LinkedIn being very helpful. Those cases showed that a migration can be successful with a proper plan, adoption of gradual strategies, automation tools, and thorough testing. The adopted methodology is based on the practical application of the obtained knowledge by migrating an open-source project, which represents modern microservice-based architectures. The process began with the detailed analysis of each service, endpoint mapping and understanding the interaction between components. Then, the gRPC contracts were defined following strict structure and naming conventions and centralized in a separate repository for the effect in order to make the management, versioning, and integration easier. The automatic generation of code to servers, clients and gateway was done using Protocol Buffer Compiler and the necessary plugins for Java and Go. During the migration, special attention was given to the coexistence of REST and gRPC, resorting to the gRPC Gateway to ensure that REST clients kept working without any changes. This approach allowed a gradual and smooth transition, while minimizing the risks. The validation of the migration’s success was made with automatic and manual tests, especially to ensure functional equivalence after the process is complete. The experience also demonstrated the importance of automation mechanisms in CI pipelines for the generation, publishing and validation of stubs. Among the faced challenges, the lack of a formal API Specification for REST APIs, which requires a manual analysis of the code, and the low test coverage are highlighted. Nevertheless, the acquired experience allowed the definition of a clear set of guidelines to support engineering teams planning a transition. The results showed that the migration of REST systems to gRPC is viable and beneficial, as long as it is thoroughly planned, has a good level of automation, and good engineering practices. The adoption of bridge tools and contract centralization allows for minimizing the risks and ensuring the operational uninterruptedness of the systems during the migration. The experience also highlights the need for as much documentation, testing, and automation as possible.
