CAP Theorem for Application Developers

Most of us are building distributed systems. This is a fact. According to Wikipedia, a distributed system is a system whose components are located on different networked computers, which then communicate and coordinate their actions by passing messages to each other. A distributed system could either be a standard three-tier web application or it could be a massive multiplayer online game.

The goal of a distributed system is to solve a problem that can’t be solved on a single machine. A single machine can’t provide enough compute or storage resources required to solve the problem. The user of a distributed system perceives the collection of autonomous machines as a single unit.

The distributed systems are complex as there are several moving parts. You can scale out components to finish the workloads in a reasonable time. Because of numerous moving parts and their different scaling needs it becomes difficult to reason out the characteristics of a distributed applications. CAP theorem can help us.

Continue reading “CAP Theorem for Application Developers”

Issue #13: 10 Read, A Handcrafted Weekly Newsletter for Humans

Hello All,
Here are 10 reads I thought were worth sharing this week. The total time to read this newsletter is 130 minutes. This week newsletter has stories on Firebase, how to manage your engineering superheroes, service discover, habits to adopt in your life, how to do full text search with PostgreSQL, being a remote developer,  few more.
For every complex problem there is an answer that is clear, simple, and wrong — H. L. Mencken

Continue reading “Issue #13: 10 Read, A Handcrafted Weekly Newsletter for Humans”

Service Discovery for Modern Distributed Applications

I am starting a new blog series (with no end date) from today. In this series, I will pick a topic and go in-depth so that I don’t just scratch the surface of the topic. The goal is to build a habit of learning each week and share it with the community. For the next few months, I will write on different aspects of building distributed systems. Each Wednesday, you may expect a new post.

I am sure we all have built applications where one application uses another application to do its job. Most of the time, applications communicate with each other using HTTP REST API but it can be other communication mechanisms like gRPC, Thrift, Message Queues as well. For example, if you are building an application that needs Twitter service for fetching tweets. To call Twitter API, you will need the API URL and access keys to make a successful API call. Most often we rely on static configuration either in the form of a configuration file or environment variable to get the API URL. This approach works fine when you are working with third party APIs like Twitter as their API URLs do not change often. The static configuration approach fails when we build a Microservices architecture based application. The definition of Microservices that I like is by Martin Fowler as described in his blog,

Microservice architecture style is an approach to developing a single application as a suite of small services, each running its own process and communicating with lightweight mechanisms, often an HTTP resource API.

Continue reading “Service Discovery for Modern Distributed Applications”

Issue #12: 10 Reads, A Handcrafted Weekly Newsletter for Humans

Hello All,

Here are 10 reads I thought were worth sharing this week. The total time to read this newsletter is 148 minutes. This week newsletter has stories on JOMO, How Netflix  works, Amazon RDS, Amazon Aurora, Deep work, and few more interesting topics.

Make your peace with the fact that saying ‘no’ often requires trading popularity for respect. — Greg McKeown

Continue reading “Issue #12: 10 Reads, A Handcrafted Weekly Newsletter for Humans”

On writing

Since last couple of years, writing has fascinated me. I became interested in writing as I started spending more time reading books. I have read more books in last couple of years than I have read in my entire life. Good books make you think, question, and become more self-aware.

Stephen King, an American author of horror, supernatural fiction, suspense, science fiction and fantasy once said

If you don’t have time to read, you don’t have time to write. Simple as that.

I think writing is the natural side effect of reading.

Continue reading “On writing”

Issue #11: 10 Reads, A Handcrafted Weekly Newsletter for Humans

Hello All,
Here are 10 reads I thought were worth sharing this week. The total time to read this newsletter is 125 minutes. This week newsletter has stories on Microservice architecture, open office, web scrapping, psudeo-AI, web design, and the rule of 50 to help you know when to give up on a book.

Continue reading “Issue #11: 10 Reads, A Handcrafted Weekly Newsletter for Humans”

The fool’s life is empty….

The fool’s life is empty of gratitude and full of fears; its course lies wholly toward the futureEpicurus

Most of us these days are obsessed with our future. In future we want to be our own boss, we want to run our own company, travel the world, become a millionaire, and so on. We are being sold the dream that life will become meaningful if we become our own boss. What this usually leads to is unsatisfied today. Our blind desires stop us from contributing to our current work in the most complete form. We make compromises in terms of quality and focus in our current jobs. This means we loose out on the training for the better future tomorrow. I think this trend is making us incompetent and we will never be better prepared to make a real difference in future. We should show gratitude and contentment in our existing job. This will give us internal peace and help us prepare for better future tomorrow.

Configuring Spring Cache Manager with AWS ElastiCache Redis (cluster mode disabled) and Lettuce

We have Spring Boot 2 application that uses Redis as the cache manager. We deploy our application on Amazon AWS where we use AWS ElastiCache Redis service in cluster mode disabled. Our setup includes a Redis master with two Redis slaves. The default Java client for Redis with spring-boot-starter-data-redis dependency is lettuce-core. When you are working with single Redis node with no slaves, using AWS Elastic Cache Redis is as simple as providing the spring.redis.url with the value of AWS ElastiCache Redis instance URL. This was the set up that we were using till a month back. As the load on the system increased we decided to use ElastiCache Redis in replicated setup to scale our reads. In AWS, Redis implements replication in two ways:

  1. With a single shard that contains all of the cluster’s data in each node – Redis (cluster mode disabled)
  2. With data partitioned across up to 15 shards — Redis (cluster mode enabled)

In our case, cached data is less than 1 GB so it fits in RAM of single node. This made us choose cluster mode disabled setup.

Continue reading “Configuring Spring Cache Manager with AWS ElastiCache Redis (cluster mode disabled) and Lettuce”

Issue #10: 10 Reads, A Handcrafted Weekly Newsletter for Humans

Hello All,
Here are 10 reads I thought were worth sharing this week. The total time to read this newsletter is 121 minutes.
It is not that we have so little time but that we lose so much. The life we receive is not short but we make it so; we are not ill provided but use what we have wastefully. – Seneca, On the Shortness of life

Continue reading “Issue #10: 10 Reads, A Handcrafted Weekly Newsletter for Humans”

One day is equal to every day

One day is equal to every day.

I came across this quote while reading a random article on the web. Since then I am thinking what could it possibly mean.  One meaning of the quote could be that all days are equal in terms of number of hours. So, in effect every day is equal in number of hours to every other day. But, this meaning does not satisfy my inner self. I believe the quote has much more profound meaning. The meaning that I derive from the quote is that the way we live one day of our life determines rest of our days as well. As I wrote in an earlier post, a single day is like a mini-life. Each day we are born (wake up in morning), live life (do daily job), and die (sleep). To understand the value system of a person, you don’t have to spend years with them. Their one day actions are enough to give you idea how they behave every other day. Most people don’t drastically change over time unless they do regular self-introspection.