Blaze your App with Gatling

Every time we write code, we think if it works fine on local, it would work fine on production too. We do check on production as well but for limited users or non-real scenarios. A system may run very well with only 1,000 concurrent users, but how would it run with 100,000? It may or may not respond on time.

Are we doing anything to deal with this kind of situation?

Flipkart’s Biggest Sale or Biggest failure?

Everyone has heard of the “Big Billion Sale” by Flipkart on 6th October 2014. Products were Continue reading

Posted in Scala | Leave a comment

Working with XML in Scala

In this blog, we will talk about how we can work with XML using Scala.

Scala treats XML as the first-class citizen. So, instead of embedding XML documents into strings. , you can place them inline in your code like you place an int or double value.

For example

scala> val xml = <greet>Hello</greet>
xml: scala.xml.Elem = <greet>Hello</greet>

scala> xml.getClass
res2: Class[_ <: scala.xml.Elem] = class scala.xml.Elem

We have created a val named xml and assigned xml sample content to it. Scala parses it and creates an instance of scala.xml.Elem.

The scala package scala.xml provides classes to create XML document, parse them, read them and store them.

Let’s see how we can parse it. XPath is a powerful tool to query the XML document. Scala provides an XPath like query ability with a slight difference. In XPath, we use forward slashes “/” and “//” to query the XML documents. But in Scala, “/” is a division operator and “//” is one of the way to comment the code. Scala prefers to use backward slashes “\” and “\\” to query the XML document.

For example

scala> val xmlDoc = <symbols>
<symbol ticker="Cisco" ><units>100</units></symbol>
<symbol ticker="Sandisk" ><units>315</units></symbol>

We would like to get the symbol elements. We can use the XPath query,

scala> val children = xmlDoc \ "symbol"

scala> children: scala.xml.NodeSeq = NodeSeq(<symbol ticker="Cisco"><units>100</units></symbol>, <symbol ticker="Sandisk"><units>315</units></symbol>)


We called the \() on the XML element and asked it to look for all symbol elements.  It returns an instance of scala.xml.NodeSeq, which represents a collection of XML nodes.

The \() method looks only for the elements that are direct descendants of the target element(i.e symbol).   If we want to search through all the elements in the hierarchy starting from the target element, \\() method is used

val grandChildren = xmlDoc \\ "units"

grandChildren: scala.xml.NodeSeq = NodeSeq(<units>100</units>, <units>315</units>)

Continue reading

Posted in Functional Programming, Scala | Tagged , , | 1 Comment

Trim Your Playbooks.

In the previous blog, We went through the basics of creating a simple playbook. Now we’re presented with the following scenario:

You are assigned the task to write a playbook which should carry out 10 tasks in order. There’s also a possibility that we have to re-use some of them in later playbooks.

The moment this problem is presented you think of the most luxurious thing which is done with two fingers: Copy & Paste.

When you mention reusability to a developer his/her ears will perk up. If you understand reusability, you will know beforehand, that this developer isn’t going to talk about copy & paste. So, Is it possible to have that reusability in playbooks? Can we write a short playbook?

Continue reading

Posted in Devops | Tagged , , | Leave a comment

Ansible Playbook Using Templates

Managing configurations of multiple servers and environments are one of the significant uses of Ansible. But these configuration files may vary for each remote servers or each cluster. But apart from some few parameters, all other settings will be same. Creating static files for each of these configurations is not an efficient solution and it will take a lot more time and every time a new cluster is added you will have to add more files. This is where Ansible template modules come into play.

Templates are simple text files that we use in Ansible which contains all your configuration parameters. During the playbook execution, depending on the conditions like which cluster you are using, the variables will be replaced with the relevant values. Most of the time we use them to replace configuration files or place some documents on the server. Continue reading

Posted in Devops | Tagged , | Leave a comment

Know a Knolder – Abhishek Giri


Image | Posted on by | 2 Comments

Understanding Ansible Playbook


Ansible is an open-source software that automates software provisioning, configuration management and application deployment, similar to Chef, Puppet or Salt. Ansible lets us control and configure nodes from a single machine. It is different from other management software in a way where Ansible uses SSH infrastructure and uses push mode and the configuration is pushed from a master machine to nodes. Ansible achieves all of this through the playbooks.

What is a Playbook?

As on the documentation of Ansible, playbooks are the basis for a really simple configuration management and multi-machine deployment system, unlike any that already exist, and one that is very well suited to deploying complex applications. Playbooks can declare configurations, but they can also coordinate steps of any manual ordered process, even when different steps must bounce back and forth between sets of machines in particular orders. They can launch tasks synchronously or asynchronously.

We can draw an analogy between a Playbook and instructions to assemble an appliance. The manufacturer includes instructions so we can put the parts together in the correct order. When followed in order, the appliance looks like what was purchased. That’s basically how a playbook works.

Continue reading

Posted in Devops | Tagged , | Leave a comment

Ansible: Do more with ease.

In software engineering, software configuration management (SCM or S/W CM) is the task of tracking and controlling changes in the software, part of the larger cross-disciplinary field of configuration management. SCM practices include revision control and the establishment of baselines. If something goes wrong, SCM can determine what was changed and who changed it. If a configuration is working well, SCM can determine how to replicate it across many hosts.

We now have talked that talk but is it easy enough to walk that talk? Since most of the challenges faced during configuration management are generally related to learning. Configuration management should require minimal learning which means we should be able to do away with complexities of the configuration with ease in syntax too.

In this blog,  we’re going to take the first leap of faith into the world of ansible.

Continue reading

Posted in Devops, Scala | Tagged , , , , | Leave a comment

Terraform: Enabling developer to create and manage deployment through code

In this blog post, We will walk you through Terraform which is a tool for building, changing, and versioning infrastructure safely and efficiently.

Terraform enables the developers to properly manage the infrastructure through code.

The set of files used to describe infrastructure in Terraform is simply known as a Terraform configuration. These files have extension .tf.

Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.

Here, we will show you how to build architecture on AWS, but Terraform can also manage other providers including Azure, DataDog, Bitbucket, DNS, Google Cloud and many more.

provider "aws" {
  access_key = "${var.access_key}"
  secret_key = "${var.secret_key}"
  region     = "${var.region}"

The provider block is used to configure the named provider, in our case “aws”. A provider is responsible for creating and managing resources.

Continue reading

Posted in Amazon, Architecture, AWS, Cloud, Devops, knoldus | Tagged , | 1 Comment

Introduction to Google Kubernetes

Over the past two years, Containerization has provided a lot of flexibility to the developer in which most popular container technology is docker. Container provide the developer a virtual environment for isolated process or application on the host system. Before everything else lets take a look what used to happen in past.

Earlier when the number of systems for running application were limited they were mostly specified by name so that user can easily identify which software or application is running on which machine. If the server dies everyone used to rush for the backup and admin  felt lucky if he got an up-to-date backup. Obviously, the same won’t work for scaling the application and the situation with this approach is not feasible when there are hundreds or thousands of servers. There should be an automation which takes full responsibility of allocating resources to the application on the specific machine, not only this  continuous monitoring and resilience is also required.

One of the main reason for deploying a service on the container is that they are flexible, lightweight, and easily scalable while deploying on hundreds of machine. Now, the question arises who is going to manage the containers on the large set of machines. that’s, why kubernetes and other container orchestration came into picture Lets, understand what it is. Continue reading

Posted in Devops, Scala | Leave a comment

Quick Start with Finagle

Finagle is an extensible RPC system for the JVM, used to construct high-concurrency servers. Finagle implements uniform client and server APIs for several protocols, and is designed for high performance and concurrency. Most of Finagle’s code is protocol agnostic, simplifying the implementation of new protocols.

Today here I am going to implement the Finagle example using Scala where I am sending the request with some message & get future of response using Finagle.

Continue reading

Posted in Scala, Web Services | Tagged , | Leave a comment