Go in Big Data

Sharing experience in Big Data, Golang and DevOps with examples.

Understanding output of free in Ubuntu 16.04

This post explains output of free command in Ubuntu 16.04 paying special attention to information missing in documentation.

Understanding output

Let's look at free output in humanreadable, wide mode:

free -hw

        total   used   free   shared   buffers   cache   available
Mem:     2.0G   566M   860M      14M       41M    531M        1.2G  
Swap:    4.0G     0B   4.0G  

Note that output of free command in Ubuntu 16.04 differs from previous versions.

There are two lines in the output. Mem row shows phisical memory stats. Swap line displays swap stats.

Phisical memory

total: Total installed memory.

used: Cacluclated as total - free -

Read more »

Demystifying ifconfig and network interfaces in Linux

This post explains ifconfig output of common developer's box, paying special attention to parameters poorly explained in official documentation. It also slightly touches Linux network interfaces.

ifconfig

ifconfig is a command line tool for UNIX-like systems that allows for diagnosing and configuring network interfaces. At boot time, it sets up network interfaces such as Loopback and Ethernet. Most of the time, however, ifconfig is used for network diagnostics.

Before diving into details of its output, let's first make clear what is an interface.

network interface

A network interface is a software interface to networking hardware. Linux kernel distinguishes between two

Read more »

Polishing Your Curl Expertise

Previous post covers bare minimum of curl you need to know for testing RESTful microservices. Read it first if you need basics. This writing focuses on corner cases and advanced options, making curl experience more enjoyable.

Microservice for experiments

For demonstrations, I've created a simple RESTful microservice in Golang. Use it if you have nothing to experiment with.

package main

import (  
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
)

type RequestSummary struct {  
    URL     string
    Method  string
    Headers http.Header
    Params  url.Values
    Auth    string
    Body    string
}

func main() {  
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        bytes, err
Read more »

Using Curl For Ad Hoc Testing Of RESTful Microservices

curl

There are plenty of tools available for testing RESTful microservices today. Most of them, e.g. SoapUI, are comprehensive solutions and best fit for creating testing suites. Using such a tool to check a single faulty endpoint would be an overkill.

So what should you choose for ad hoc testing instead? There are simplified GUI tools, e.g. Postman, and many developers are happy with them. But if you are after ultimate performance and love command line, there is a better option - curl. In this post I'll show how to check RESTful endpoints using curl with a lot of

Read more »

How To Create Health Check For RESTful Microservice In Golang

Health Check

Imagine you've recently released and deployed to production a cool RESTful microservice you worked on for a while. You heaved a sigh of relief just to hear from Ops team that your service is unstable. You are damn sure that the service should be fine, but you get a feeling that there could be something wrong with services it depends on. What should you do?

Health check will come to your rescue. It is an endpoint in your service returning status of your application including statuses of connections to all external services your service directly depends on. In this post

Read more »