November 14, 2017

Asynchronous processing with remote callbacks using WebSockets

This post is about processing a task asynchronously and update the client with live feedback. For instance, a build is triggered from the client which runs multiple tasks in the backend and updates the client as soon as every task is processed. Could be any task triggered from the client with is compute heavy or runs in non-deterministic time. Let’s implement a WebSocket server to maintain a stateful connection with the client. ... Read more

July 10, 2017

Exposing kubernetes pods to the Internet

For those who don’t know what a pod is (in kubernetes terms), a pod can be considered as a logical host with collection of one or more containers, shared storage and network namespace. The aim of this this post is to expose one or more pods to the Internet. Let’s define the pod first. apiVersion: v1 kind: Pod metadata: name: foo labels: application: foo spec: selector: matchLabels: application: foo containers: - name: foo image: gcr. ... Read more

February 5, 2017

Dismissing Garbage collection in Node.js - A failed experiment

The aim is to fork a number of workers (2 x num.of cores) + 1 from a master/parent process which manages them. When the resident set size of a worker increases the defined throttle, master removes the worker from the cluster gracefully, shuts it down, spawn a new fork, adds it back to the cluster. Why doing this at all? Blind curiosity, try to avoid the GC pauses and most importantly, inspiration from Instagram Engineering team’s article on dismissing garbage colletion in python. ... Read more

November 4, 2016

What you need to know about front-end caching

Was reading on optimal ways of caching, mainly to offload the server by reducing the number of hits. 304s are beautiful, aren’t they? Moving your scaling to the frontend has a lot of benefits which includes serve content faster, fewer origin hits, .. Let’s look at the various levels where caches could be implemented. Browser level CDN proxy level Application level Browser cache Browser can cache resources locally and we can specify how long the resources should be stored locally (will talk about the cache control rules in a while). ... Read more

April 28, 2016

Farewell 172.17.42.1, you will be missed!

A week ago, continuous beeps from alerts slack channel woke me up early in the morning. Digging up the logs, I saw “System rebooting.” Why? FYI, the machine runs CoreOS. In a while, we came to know CoreOS and the tools it ships are updated automatically as new versions come out. They say “We believe that automatically updating the operating system is one of the best tools to achieve this goal. ... Read more

January 28, 2016

Renderer - Main process communication in Electron

Electron (or) Atom Shell is used to build cross platform desktop apps with web technologies. With electron, you can do a lot more than just wrapping your webpage into an app. In browsers, web pages usually run in a sandboxed environment and are not allowed access to native resources. Electron have the power to use Node.js APIs in web pages allowing lower level operating system interactions. Well, how does this work? ... Read more

January 19, 2016

Resolving `module isn't defined` error in Electron

Well, I got a chance lately to build a desktop app for DoSelect and we came across this weird issue moment not defined We use moment.js for a couple of things. One of the answer from Stack Overflow suggested to turn node-integration : false but we needed node-integration for some other purposes. So, what/where is the problem? module is defined, even in the browser-side scripts. This causes moment.js to ignore the window object and use module, so the other scripts won’t find moment in global scope. ... Read more

January 16, 2016

Node.js clustering maintaining sticky session

NodeJS is single threaded. It is event-driven and single-threaded with background workers. Scaling up a node application is possible by splitting a single process into multiple processes or workers by using cluster module. The cluster module allows you to create child processes (workers), which share all the server ports with the main Node process (master). A simple example {% highlight javascript %} var cluster = require(‘cluster’) var http = require(‘http’) var numCPUs = require(‘os’). ... Read more

October 18, 2015

It's been a month ..

.. since I joined DoSelect. At DoSelect, I work on the JavaScript parts of the codebase. Prior, as Google Summer of Code dev, I revamped the API and web interface of Steam Collaboration Platform. I’ve helped build couple of small components at Applait. Also have been reviewing applications for Firefox Marketplace for almost 2 and a half years now. If you are aching to read more about me, here you go - http://dolftax. ... Read more

July 31, 2015

Dockerizing sTeam

I am currently working with sTeam collaboration platform as a GSoC dev under FOSSASIA umbrella. sTeam has a lot of depencencies. A lot! One major issue faced by developers was version conflict between dependencies. Docker seemed to solve this issue. Docker is a great image distribution model for server templates. It uses btrfs (a copy-on-write filesystem) to keep track of filesystem diff’s which can be committed and collaborated on with other users (like git). ... Read more

Copyleft Jaipradeesh