Asaf's technical blog

Fencing Tokens in Node.js

|

In my experience, the average Node.js developer tends to be less concerned about thread safety issues and race conditions than the average developer who uses more traditional languages such as Java, C# or C++. Perhaps the reason is that Node.js code is executed in a single-thread environment, so the risk of multiple threads mutating the same shared memory at once is avoided. However, this does not mean that we’re entirely free from race conditions. For example, our database can be thought of as a shared state in which race condition may manifest.

How does Node.js manage timers internally

|

Timers are an essential part in the Javascript developer tool set. The timers API has been with us a long time, dating back to the days when Javascript was limited to the browser. This API provides us with the setTimeout, clearTimeout, setInterval and clearInterval methods which allows us to schedule code for later execution, either once or repeatedly.

Distributed consensus and the Raft algorithm

|

Raft is an algorithm for distributed consensus, created by Diego Ongaro and John Ousterhout from Stanford University. The main drive for the creation of Raft was the fact that Paxos, while widely considered the standard distributed consensus algorithm for over a decade, was also considered very hard to understand. The authors’ intention thus was to come up with a different, easy to understand distributed consensus algorithm. In this post I will try to give an introduction to the Raft algorithm.

RabbitMQ - Persistency vs Durability

|

Once you start getting serious with RabbitMQ, around the time you graduate from running small tests on your laptop to actually processing real production data, is usually the time you start to wonder about reliability; How will my server behave once it fails and restarts? And what will happen to my messages? You may have met the terms durability and persistency, which sound like they have somewhat similar meaning. Why do we need both? and what are the differences between them?

How Well Do You Know Node.js? - Answers (Part 2)

|