December 2020 – Brain Mentors Skip to content


What is RabbitMQ? RabbitMQ is an open-source message-broker software. It has implemented the Advanced Message Queuing Protocol. RabbitMQ works very similar to a post box. The producer i.e., the originator of a message will send the message to post box and than the message will reside inside post box until the message is handed over to the consumer/receiver. In rabbitMq instead of a postBox we will use a queue. This queue will retain the messages until taken by the consumer. The main benefit of using this message broker is that the producer and the consumer don’t need to understand each other language. that is a consumer can be written in javascript and a consumer could be a java program. They just should know how to connect with RabbitMQ queue. For example : here is a simple program to show a producer, consumer and a queue. This is a sender program.

Micro Services

What, how and why of microservices? So, before understanding microservices we should be aware of the fact that these are also a type of web services. What are web services? , Web Service is an interface which expose a service on HTTP/ HTTPS/SOAP protocol for communication, exchanging data b/w different technologies. Let’s understand this concept using trivago. So here trivago is very known hotel booking sites. You need to enter the hotel name or the place where you want to have a booking, enter the check in and out time etc and click search. On that search button clicked you are shown with multiple options available for your search. So what happens internally, where does trivago gets its data from? Actually trivago collects its data from several places like Airbnb, oyo, etc. Now trivago collects all the data using the provided web services and fetch the result in different formats.

Worker Thread in NodeJs

Worker Thread in NodeJs The Basic idea behind worker thread is to do cpu intensive work without blocking the main thread. As we know that node js run on a single thread (event loop) hence using it for some highly cpu centric job would not be a good idea. As it will increase the request processing time. And user/clients of the applications will get the result in more time. Now having a worker thread would look something like the below diagram. Now unused part of cpu will have a thread running onto them and without mingling with the main thread execution and a code piece can be executed. Lets start with the main.js program(below). Here, a main thread will start to execute the code when we will run this particular file i.e., main.js. IsMainthread will return either true or false based on who is executing the if condition. So right


Redis Introduction Stands for remote Dictionary Server. • It is a in-memory key-value pair data store. • It is used as a database, cache, message broker and queue. How Redis works? Redis store data in-memory and not on HDDs/SSDs. Thus seek time delays are eliminated in redis. Redis has variety of data structures. • Redis supports Replication and persistence hence very fast read operations. Redis use cases Caching Database queries, persistent session, web page, images, metadata etc all can be cached. Data access latency is reduced. Throughput is increased. And database will have less load. Chat, messaging, and queues Supports publisher/subscriber model with pattern matching and number of data structures. Session store Rich media streaming Machine Learning   Redis Language support Python Java PHP Perl Go Ruby C/C#/C++ JavaScript js Redis Data structure String Set Lists Sorted Lists Hashes Redis architechture Memory optimization and architecture Using 32 bit instance As

Sign Up and Start Learning