Alternatives to REST for client-server communications

Although REST is a widely adopted pattern for communications among microservices, Open Liberty supports alternative options that might be better suited for some application scenarios. These alternatives include GraphQl, gRPC, and WebSocket.

Despite the ubiquity of REST-style communication among microservices, REST comes with tradeoffs in capability and performance that can make it a less than ideal solution for some use cases. Issues such as over-fetching and under-fetching of data, lack of real-time communication, and tight coupling between client and server can lead to performance and maintenance concerns for certain types of applications. To address these issues, developers can use alternative protocols and technologies that specifically address the shortcomings of REST.

For example, GraphQL is an open source data query and manipulation language for APIs that directly addresses problems with over-fetching and under-fetching of data that might occur with REST APIs. Similarly, the WebSocket protocol enables real-time bidirectional communication between a server and one or more clients, which is not feasible in REST architecture.

The following topics provide information about REST alternatives that you can implement with Open Liberty.

Build GraphQL applications with MicroProfile GraphQL

MicroProfile GraphQL is an API for building services that exercise fine-grained control over the data that they request and receive. A GraphQL service can simplify data retrieval by collating data from multiple sources into a single object.

Provide and consume gRPC services on Open Liberty

gRPC is an open source remote procedural call (RPC) framework that connects clients and services in language-agnostic way. You can provide and consume gRPC services from your web applications that run on Open Liberty.

Send bidirectional messages between services with WebSocket

The WebSocket protocol supports real-time bidirectional messaging between a client and server. The Open Liberty Jakarta WebSocket feature supports applications that use this protocol.