Blogs


Rest API with Go & Gorilla Mux

Gorilla is a web toolkit for the Go programming language. The gorilla/mux implements a request router and dispatcher for matching incomings requests to the respective handlers.

One of the cool feature it has is that the registered URLs can be built or reversed which helps maintaining the references to resources and nested routes are only tested if the parent route matches. This is useful to define groups of routes that share common conditions like a host, a path prefix or other repeated attributes.

Read on →

Tuning Apache Kafka’s performance

Well, Apache Kafka is one of the best pub-sub messaging system used widely across several technology’s based industries. Originated at LinkedIn and was open sourced in early 2011.

Ok, so what so special about Apache Kafka ? Here are the few things Kafka is meant to handle.

  • High throughput to support large volume event feeds.
  • Real time processing of enormous amount of data.
  • Support large data backlogs to handle periodic ingestion from offline systems.
  • Support low - latency delivery of the messages compared to other messaging systems
  • High Availability, Fault Tolerance.

So what else are you looking ?

Read on →

Blockchain - Really worth in elections ?

Issues with EVM ( Electronic Voting Machine ) have been the talk of the town for quite a while in India nowadays. Political parties have been taking about going back to voting mechanism using ballot boxes, wherein there would be very less possibility of non-legitimate voting. EVMs are prone to hacking, untrusted votes, digital errors as explained by these political parties.

I ask you political parties this, why ballot boxes or directly “why papers” ? Why cut trees to achieve your goal considering the fact that, we are living in the - digital era with brilliant minds across the country to make things possible using technology.

The recent government (people too) has been keen towards its programme of Digital India.

Read on →

Fancybox2 to Fancybox3 for image gallery

I recently migrated my image gallery to Fancybox3 from Fancybox2. Fancybox3 has some of the advantages over its previous version. The important one I like is the fact that you have to code less.

  • Import the javascript
  • Wrap the images with class and the work is done.
  • It supports the image security too. Read on →

Distributed Computing - Quorum

In a distributed database system, a transaction could be executing its operations at multiple sites. Since atomicity requires every distributed transaction to be atomic, the transaction must have the same fate (commit or abort) at every site. In case of network partitioning, sites are partitioned and the partitions may not be able to communicate with each other. This is where a quorum-based technique comes in. The fundamental idea is that a transaction is executed if the majority of sites vote to execute it.

Quorum Consensus Protocol

This is one of the distributed lock manager based concurrency control protocol in distributed database systems. It works as follows;

  • The protocol assigns each site that have a replica with a weight.
  • For any data item, the protocol assigns a read quorum Qr and write quorum Qw. Here, Qr and Qw are two integers (sum of weights of some sites). And, these two integers are chosen according to the following conditions put together;

Qr + Qw > S - rule which avoids read-write conflict. (i.e, two transactions cannot read and write concurrently)

2 * Qw > S - rule which avoids write-write conflict. (i.e, two transactions cannot write concurrently)

Here, S is the total weight of all sites in which the data item replicated.

Read on →