Why we use Protocol Buffer instead of Json

The definition of Protocol buffer is given below,

“Protocol Buffers are a way of encoding structured data in an efficient yet extensible format”

  1. It allows as us to define the schema in .proto file. So we have to generate the mapping classes using that file. Its easy to know the request the response fields by going through it.
  2. Backward compatibility is very easy as we are numbering each fields in the proto file
  3. Its best suitable for the backend application. Ours is a ReSt application which interacts with an another backend application. Obviously the backend application supports only protobuf format so we dont have any choice other than using Protobuf.
  4. We can specify the required and optional flag for each fields. This allows us to extend the functionality in the future without making any changes to the client application

Docker Commands

Docker compose is a tool used for defining and running multi container application. All the configuration stuffs will be written in a YAML[Yet Another Markup Language] file.

Remove all the images:
docker rmi $(docker images -q)

Start the Docker containers:
docker-compose -f <DOCKER_COMPOSE_FILE_NAME> up -d

Stop the Docker containers:
docker-compose -f <DOCKER_COMPOSE_FILE_NAME> stop

Remove the Docker containers:
docker-compose -f <DOCKER_COMPOSE_FILE_NAME> rm

Restart all the Docker containers:
docker-compose -f <DOCKER_COMPOSE_FILE_NAME> restart

Restart a specific service or Docker container:
docker-compose -f <DOCKER_COMPOSE_FILE_NAME> restart <SERVICE NAME>

Stop all containers:
docker stop $(docker ps -a -q)

Remove all containers:
docker rm $(docker ps -a -q)

Command to follow the logs:
docker logs -f <CONTAINER_ID>

Command to follow the logs since from a particular time:
docker logs -f –since=2016-05-10T12:00:00 <CONTAINER_ID>

Remove all the images which has none tag:
docker rmi -f $(docker images | awk ‘{print $1, $3}’ | grep “none” | awk ‘{print $2}’)

Riak

I have used Riak DB in my current project and it’s very easy to use and it provides an easy way to query it. We use Riak since we want a No SQL database which should be easily scalable and easily instantiable from cloud storage like openstack.

There are few things to remember. Those are given below

  • Each bucket should be assigned with a search index. Using which we can perform search against DB