Image Source: YouTube

We encountered many perplexing issues throughout our ongoing service mesh journey with Istio at my company, many of which left us wishing that we had known about those pitfalls in advance. This is one such pitfall that you might encounter while using Istio in large Kubernetes clusters. By sharing my experience with this issue, I hope to help you avoid it in your own Istio travails.

The issue — excessive memory consumption by Istio proxy sidecars

Envoy proxy sidecars are the cornerstone of the Istio service mesh architecture. …


Source: Getty Images

Context

We have recently introduced the Istio service mesh in our Kubernetes clusters to take advantage of its traffic management, security and observability features. One of our key requirements is to enforce TLS/encryption on traffic in transit across all layers. Within the cluster, this is done via mTLS provided by Istio. For external traffic as well as traffic at the service mesh edge, we use the F5 BIG-IP appliance, which not only acts as the load balancer for external ingress into the cluster, but also provides the TLS bridge between external traffic and the Istio ingress gateway.


Image Source: www.toolshero.com

I have seen this happen on more than one occasion. You build an enterprise application or a service that uses a persistent data store. The application performs CRUD operations on the data store as part of its functions. You deploy the application, and everything’s well and good. Then, along comes the product owner with some new requirements for the application to start doing something more in response to data being changed in the data store, such as notifying some external application of the changes, creating an audit trail, etc. You either update your CRUD services to include the additional features…


Image Source: Wikipedia

MongoDB comes with a change stream feature that enables applications to subscribe to streams of change events taking place inside MongoDB. The ability to receive data changes as events makes it simple for applications to implement use-cases that depend on the ability to react to such change events.

One useful application of MongoDB change streams is data change auditing — keeping track of changes to the fields of a collection (who changed a field, when, and what change was made?). Such granular field-level data auditing is often necessary for regulatory and compliance reasons in domains such as healthcare, finance, etc…


Image Source: Ashley McNamara

Goroutines are a simple and lightweight concurrency mechanism that is very popular among Golang developers. It is common for Golang programmers to leverage Goroutine semantics to achieve program execution efficiency through parallelism. However, care must be taken when designing Goroutine implementations in order to avoid unintended side-effects. I will highlight one such side effect that I ran into while writing my own Goroutines. As it turns out, this was a documented pitfall that I wasn’t aware of until I ran into it myself.

The program

The logic I needed to code was simple: I had a slice of functions of a certain…


Image Source: Forbes

Apache Kafka is widely used in event-driven architectures for asynchronous, messaging-based integration between applications and services. Most use-cases deal with the consumption of messages as they are being produced. Once a message is successfully processed, consumers move on to newer messages, and don’t have to deal with the old ones. However, there are certain situations in which revisiting older messages and “replaying” them might become necessary. For example, a bug in the consumer might require deploying a newer version, and re-processing some or all of the messages. In another scenario, some part of the consumed data from messages may get…


Source: NASA/JPL-Caltech

Context

MongoDB makes it easy to organize and store data in hierarchical document structures. However, fetching specific data that is embedded in nested subarrays of a deep hierarchical document can present a challenge, especially when you want to fetch only the data that you need from the database, and nothing more. I will illustrate a technique to efficiently fetch deeply nested subdocuments in MongoDB, including an implementation of the solution in Golang using the mgo driver.

Note: The code examples have been tested with Golang 1.10.1, MongoDB 3.6 and mgo 2.0.

Understanding the Problem

Let’s assume we have a MongoDB collection to store catalogs…

Pranay Singhal

On a quest to learn, distill and share.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store