2024-03-27

  • Docker Swarm
  1. Rolling Updates

To reduce the downtime of an application and also to introduce minimal downtime for rolling updates while docker swarm. Here lets us take an example image of alpine:3.17.7 and with the command to ping google.com, to demonstrate the rolling updates,let us update the image to alpine:3.18.6 while the container is running.

Pre-requisites are the enable the docker swarm mode, and add a worker node to the cluster. docker service update --image alpine:3.18.6 helloworld

  1. Rollback Updates

To continue from the above rolling updates, if many such cases we would want to rollback to the previous state of the service, due to a bug etc, in our example we would want to rollback to our previous state which is from alpine:3.18.6 to alpine:3.17.7 we use the command docker service rollback <service-name>

[node1] (local) root@192.168.0.12 ~
$ docker service rollback helloworld
helloworld
  • API Architecture

SOAP,REST,GraphQL and gRPC are most popular API architecture, in this digitizing world where large amounts of data is being transferred

  1. REST REST stands for REpresentational State Transfer, is a widely used architectural style for building web API’s. REST API’s uses HTTP requests to retreive and manipulate data. Key characteristics of REST include:

Resource Based: REST API’s are based on concept of resources,which are exposed through URL’s. Stateless: REST API does not maintain the state between two requests,hence stateless. CRUD: REST API’s support Create,Read,Update and Delete operations for manipulating data. Flexible: REST API’s are flexible,used for many purposes in general.

  1. GraphQL GraphQL is query language for API’s, which is more flexible than REST. Allows clients to specify exactly what data they need, which reduces the data transferred over network.Key characteristics:

Strongly Typed: clients and servers agree on the structure of the data exchanged. Query Based: clients specify exactly what they need and receives only that data. Single Endpoint: GraphQL has single endpoint,which simplifies client-server communications Schema driven: API schema defines the type of data available and operations that can be performed on that data.

GraphQL uses POST HTTP method for all the operations be it GET,POST etc it uses POST HTTP method.

  1. gRPC gRPC Remote Procedure Call open source framework developed by Google for building Remote Procedure Calls API’s.Unlike traditional API’s that rely on HTTP methods,gRPC uses more efficient and lightweight Protocol Buffers as the datainterchange format and it supports multiple programming languages. Using protocol buffers,faster and efficient communication is achieved.gRPC supports bidirectional streaming real-time communication between clients and servers.