SaFi Bank Space : Communication protocol between microservices

Status

COMPLETE

Impact

HIGH

Driver

Juraj Macháč (Unlicensed)

Approver

Ion Mudreac

Contributors

Jan Görig (Unlicensed) Slavomír Kocka (Unlicensed)

Informed

Due date

Resources

(blue star) Background

We are building an architecture based on microservices. Hence, it’s expected there will be a lot of communication between them. We need to choose a proper protocol. The most obvious protocols to choose from were gRPC and REST. Generally, gRPC seems to be more performant, but the team does not have experience with it.

The protocol will be used by the services, and it is expected that we will create a GQL service layer between the services and Frontend to provide a unified service which the FE will call, and also to make the FE save some networking.

(blue star) Options considered

gRPC

REST

Description

Performance-oriented protocol over HTTP2 based on protobuffers

Standard representational state transfers. JSON over HTTP.

Pros and cons

(plus) better performance

(plus) shorter definitions, less boilerplate

(plus) contract first by definition

(plus) native data types

(plus) easy service creation without Spring Boot

(minus) no experience with it across the team

(minus) only fresh libraries supporting generating a GQL layer

(plus) well known across developers

(plus) simple to use in Spring Boot

(plus) accessible using external tools (e.g. curl). But there seem to be some tools for gRPC as well

(plus) better debug possibilities

(plus) less fear of the unknown

(minus) potentially worse performance

Estimated cost

MEDIUM

MEDIUM

(blue star) Action items

(blue star) Outcome

REST was chosen for its broader use in the community, as well as having better support for tooling such as generating the GQL layer.

The performance downsides should be possible to minimize by leveraging the HTTP2