Would you like to work with me? We are hiring engineers at SemaphoreCI. Apply here.

Hi, and welcome! My name is Igor Sarcevic. I'm a software engineer. This is my personal site where I write about tehnology, share my insights and opinions about software development, and describe the daily challenges of being a developer. I work for RenderedText where I develop SemaphoreCI, a hosted continious delivery platform focused on speed and simplicity.

Find on me on Twitter, LinkedIn or GitHub.

Articles

50 The PostgreSQL Query Cost Model

Slow database queries harm your organization in many ways. They can damage the reputation of otherwise great applications, make background processing painfully slow, and drastically increase the cost of your infrastructure. As a seasoned web developer, it is absolutely essential to learn about optimization strategies for your data layer.

49 Deadlocks in PostgreSQL

In concurrent systems where resources are locked, two or more processes can end up in a state in which each process is waiting for the other one. This state is called a deadlock. Deadlocks are an important issues that can happen in any database and can be scary when you encounter them for the first time.

48 Multi Version Concurrency Control

The most prominent feature of PostgreSQL is how it handles concurrency. Reads never block writes, and writes never block reads. To achieve this, PostgreSQL uses the Multi Version Concurrency Control (MVCC) model, an elegant solution for a very hard problem. If you want to design highly concurrent applications, you should really invest the time to understand the bits and bolts of this mechanism.

47 Transaction Isolation Levels in PostgreSQL

Misunderstanding transaction isolation levels can lead to disgusting side effects in your application. Debugging such issues can be more than painful. The SQL standard defines four levels of transaction isolation. Each of these isolation levels defines what happens if two concurrent processes try to read data updated by other processes.

46 Selecting for Share and Update in PostgreSQL

A regular select statement does not give you enough protection if you want to query data and make a change in the database related to it. Other transactions can update or delete the data you just queried. PostgreSQL offers additional select statements that lock on read and provide an extra layer of safety.

45 Advisory Locks and How to Use Them

PostgreSQL provides the means for creating locks with application defined meaning. These locks are called Advisory Locks and are an ideal candidate for concurrency control where the standard MVCC (multiversion concurrency control) doesn’t fit the bill. Advisory Locks can be the perfect tool in your arsenal when you need to control access to a shared resource in a distributed system.

44 Understanding PostgreSQL locks

Locking is an important topic in any kind of database. Without properly handling locks, an application might not only be slow, it might also be wrong and behave in some insane ways. Therefore, learning proper locking techniques is essential for good performance and correctness of our applications.

43 Separating Commands and Queries

I have learned an important lesson this year. A clear separation between queries and commands can bring a lot of long term benefits to your code.

42 Specific time & Specific place

Being more productive was always a topic that interested me. Small life hacks here and there can definitely add up.

41 Intimate connections: Sharing a database

Your monolith was slowing you down, and you have decided that it is time to invest in a multiple service based approach. There were lot of new things to learn, but finally, you are free to experiment with new technologies. Your services can be developed & deployed independently. Life is good.

40 Monorepos: Monoliths in Disguise

Your project and organization are getting bigger, and you start to notice that your monolith is getting out of hand. Trying out new technologies is out of question. You are stuck with the same language and platform from 5 years ago. Microservices are here to save the day! You decide to expose an internal API, and limit development of new features exclusively as microservices.

39 Why I fell in love with running?

If you are a bit like me, you are naturally quite neurotic and experience feelings such as anxiety, worry, fear, anger and frustration more often than you should. Deep down, your rational self knows that these feelings should not control your life. However, detaching from the ‘now’, zooming out and focusing on the big picture is easier said than done.

38 Linux utils that you might not know

I’ve used Linux as my primary operating system for well over ten years, yet I still stumble upon things that are completely unknown to me. For example, several days ago, I wanted to display a formated table in my terminal.

37 Reducing overhead

When I started writing articles for this blog, I only needed to open a text editor, write something interesting and publish it. This in itself was already hard enough. Expressing your own thoughts and feelings to the world is frightening, yet the practice is very rewarding and eyeopening at the same time.

36 Faster Rails: Is Your Database Properly Indexed?

My Rails app used to be fast and snappy, and everything was working just fine for several months. Then, slowly, as my product grew and users started to flock in, web requests become slow and my database’s CPU usage started hitting the roof...

35 Faster Rails: How to Check if a Record Exists

Ruby and Rails are slow — this argument is often used to downplay the worth of the language and the framework. This statement in itself is not false. Generally speaking, Ruby is slower than its direct competitors such as Node.js and Python...

34 Merging to Master is not the end of the line

After weeks of planing, painful debugging sessions, and making sure that everything is covered with tests, your feature branch turns green. You are ready to merge into master and deploy to production. You hit the “Merge” button on GitHub, open your CI service and watch how master turns green. Automatically, deployment to production is triggered, and after several minutes your new feature goes live.

33 The Power of Interfaces in Ruby

Ruby is not the fastest language, nor is it the simplest language, but damn it, it is definitely one of the most fun languages out there. For someone like me, who enjoys programming maybe a bit too much, a language that puts little or no limitations on the things I can tweak feels very natural and an obvious choice when it comes to solving complex issues.

32 Better Sleep

Every three months, I like to sit down, zoom out from daily issues, and focus on the big picture. I like to write down the things I want to achieve, and to find out what is really important to me. This three month schedule is ideal, as it is not too long so that I lose focus, nor is it too short for it to feel daunting and boring.

31 Sleek and Pretty Tmux

A good craftsman is known by his tools. He never uses the biggest hammer in his shed to fix a little bump, neither does he use a duct tape to join together the most fragile parts of his craft. For a good craftsman both a hammer and a duct tape are vital elements of his toolbox. He has a good eye, and the intuition to choose the most appropriate tool for every situation he faces.

30 Lightweight Docker Images in 5 Steps

Deploying your services packaged in lightweight Docker images has many practical benefits. In a container, your service usually comes with all the dependencies it needs to run, it’s isolated from the rest of the system, and deployment is...

29 Books, books, books!

This year I made a concious effort to improve many things in my life. I have started to exercise regularly, improved my diet drastically, started to write a journal, and to retrospect my life and goals on a regular basis. One of changes that I am most proud of is my changed attitude toward books.

28 BalCCon2k16: From Ruby to Elixir

My talk from BalCCon2k16 — a short tale about our transition from Ruby to Elixir as our main language for developing SemaphoreCI.

27 The importance of a good command line prompt

A lot of developers choose to avoid the often big, clumsy and complicated IDEs in favor of the Linux command line. At first sight the command line is inferior to the experience you get from a full blown IDE. However, the beauty of the command line is just that. It is fast, simple, and by default it comes with very small set of pre-installed features.

26 Zen moments in life

A Serious Man is probably one of my all time favorite movies. The protagonist, a simple physics professor, with a simple, happy life, is suddenly hit by a streak of miss fortunate events. His wife leaves him, while he is forced out of his own house. He is blackmailed at work.

25 Getting Started with SSH

Over the last fifteen years, SSH has become a standard tool for remote management of Unix-like systems and many network devices. SSH stands for Secure Shell, and is one of the ways to get a command line (shell) access on a remote machine...

24 How to Deploy Sinatra Applications with Capistrano

Rails is great, but often it is not the best tool for creating smaller applications. For smaller size apps, especially those that are mainly focused around pure JSON APIs, Sinatra is often a far better option. Unfortunately, the majority...

23 Getting Started with Node.js and Jasmine

It’s a shame that, almost since its creation, JavaScript had been considered more of a quick hack than an actual programming language. Lacking the tools and the community that other popular languages had, for a long time it was a language...

22 Getting Started with Node.js and Mocha

Mocha is a testing library for Node.js, created to be a simple, extensible, and fast testing suite. It’s used for unit and integration testing, and it’s a great candidate for BDD (Behavior Driven Development).

21 Chatting over the Wall

This is how usually all our geeky adventures start out: A colleague walks up to my desk and says: “I must show you something interesting!!!”. Last Friday this cool thing was the wall command.

20 Running scripts on remote machines

Several days ago a colleague and I wanted to check whether our caching system contains all the files that we expect it to contain. We started by writing a bash command that would list and compare the available files. It had the following structure:

19 Comparing files on different servers

Let’s say you have two servers named gandalf and charmander, and a configuration file config.xml that should be present on each server. Due to some human error the files got different and your servers started to act weird. It would be nice to compare them and find out what part of them is different.

18 Moving files with curly braces

Did you ever had to rename a part of a relly long filename?

17 OOP in the age of ES6

Recently, I have become more of a “Ruby/Bash/Haskell” guy, but JavaScript will always remain one of my favorite languages, and I couldn’t be happier when I saw the new new upcoming ES6 standard.

16 Database Tests with Rails

We, software developers, like to call ourselves computer scientist, software engineers or data scientists. Hah, what a load of bulls*it!

15 Arithmetic in the Shell

I remember the first time I tried to use the shell. It was weird that I had to type in things and not just click around to get things done. But gradually I got used to it, and after a while it became my primary way to interact with my computer.

14 Sorting your production.log

Many developers fail to realize that by using the basic Unix tools, you can find on any server, you can find and collect valuable data from your logs. Often the data you need can be found without using any external services, including but not limited to service measurements.

13 Select and count your production.log!

Last time, I have demonstrated how we can put together simple filters to show only the lines we are interested in. This time I will show you how you can manipulate these lines and select only the parts you really need.

12 What can you learn from production.log?

Many developers fail to realize that using the basic Unix tools, you can find on any server, you can find and collect valuable data from your logs. Often the data you need can be found without using any external services, including but not limited to service measurements.

11 Running shell commands from Ruby

Ruby is an excellent language offering us a simple and human friendly interface, however for system administration or simple task automation the shell is a much better alternative. Luckily, combining them is easy.

10 Sms compiler service

The majority of today’s development is oriented around the web or around desktop/mobile applications. For the average programmer it could even seem like there is no other programming area out there. However, there is actually a huge number of programs developed for cars, televisions, phones, and similar everyday technologies. This article is focused on a small fraction of those areas — sms messages.

9 Create a programming language

I have been programming for a long time. Probably much longer than I want to admit. Yet, for a long time, there was something mysterious about the way I created my programs. Yes, I could write a lot of stuff in programming languages, but I had no idea how to create a programming language itself.

8 A challenge

Not so long ago, while reading an article on hacker news, I came across a strange little programming puzzle that seemed silly and trivial. I was sure I could solve it in a matter of minutes if I just sit down and think about it a little. Yet, the problem haunted me for weeks, and in one moment I just had to sit down and solve it. And what can I say, it was really hard, way harder than I tough. Here are the rules of the challenge.

7 Shebang

Unix systems are really smart when it comes to interpreting your application. Not only do they provide you with an excellent environment for development, but also let you specify the interpreter in you source file. As it turns out, this technique lets you write an application in any programming language without forcing your end users to know the details of your implementation. This article is about describing this simple technique.

6 Escape Sequences - A Quick Guide

Two years ago I thought I knew a lot about the Linux command line. Then I started digging deeper. Replaced Bash with Zsh, learned about jobs, started writing shell scripts, and even ditched Sublime text in favor of editing with command line Vim. Again I thought I know a lot about the Linux command line. Then I started digging deeper again…

5 Thor - Awesome CLI applications

Have you ever wanted to create an awesome command line application but was lost in the sea of options parsing? Well, if you did, and even if you didn’t, Thor is here to help you.

4 Sinatra applications with RSpec

There are times when the only thing I want to create is a simple API. In the Ruby ecosystem the standard for creating something simple is Sinatra. But, there are a lot of things you miss in Sinatra that you have predefined in Rails. Sinatra let’s you define and include only the things you actually need. Maybe this is a good thing, maybe it is not.

3 Progress bar for shell apps

Downloading a file, backing up your database, or installing a package for your system are all instances of long lived processes that we encounter daily. When such a process takes a long time to finish, it is always nice to give some kind of visual cue to the user.

2 Alias methods in CoffeeScript

In programming we like to reuse stuff. Data, variables, classes and even whole systems. We have a rule of thumb to only write code if it can not be found somewhere else. But sometimes the same thing can have a different meaning in a different context. So in order to reuse code but have a meaningful name in various contexts, we use aliases.

1 Pipes in the shell

Here is a story of my typical work session in the shell. It starts by a wish to make the computer execute some of my commands. For example, I want to list all the files in the current directory. From prior knowledge I know that the ls command does exactly that, so I use it, and get the desired output. But I am out of luck, the current directory contains too many entries and I just can’t scroll so much up in the history.