Building a Distributed Sequence Generator with ZooKeeper and C#

Building a Distributed Sequence Generator with ZooKeeper and C#

1. Goal and Motivation This demo project explores how to assign unique, dynamic sequence numbers to multiple server instances in a distributed environment, inspired by challenges that surface when designing things like global ID generators (e.g., Twitter’s Snowflake). As described in the project’s README, the scenario began as a typical interview problem: how do you ensure each server instance receives (and keeps) a unique ID, especially if instances are started, stopped, or restarted? ...

March 17, 2025 · 5 min · 1047 words · Raul
Improving latency by 20x times!

Improving latency by 20x times!

I want to share my experience in improving our service latency and the steps I’ve taken to get there. As a result, the P75 Latency went down from more than 100 milliseconds to less than 5! By de-normalizing the SQL queries and creating one specific cache to fit our needs. Situation Our service is a read-heavy system, with a ratio of 99-1 reads over the writes Created in dotnet core, we use EF core as ORM (Object Relational Mapper), and our main DB is Postgres (relational DB) We used Redis for caching. But it was not a custom cache but yes a “general propose” one. We used a library that acted as a middleware between EF and the DB, named the Second-Level Cache. Very high latency (P75 ~ 140ms and P99 ~ 4s) with high peaks of more than 2 seconds! Frequent incidents! A lot of DB connections were created when the cache was cold, so reached the Postgres connection limit, and new pods were not created, even if existing ones were in a bad state. ...

October 9, 2024 · 7 min · 1294 words · Raul
Interpolate 2D Points Using Bezier Curves in WPF (and Javscript)

Interpolate 2D Points Using Bezier Curves in WPF (and Javscript)

[Original Article] Sample on GitHub (WPF) Sample on Github (JavaScript) Live example in JavaScript (ReactJs) Introduction Interpolating points sometimes is hard mathematical work, even more, if the points are ordered. The solution is to create a function using the points and using an extra parameter t that represents the time dimension. This often is called a parametric representation of the curve. This article shows a simple way of interpolating a set of points using Bezier curves in WPF. ...

October 2, 2024 · 5 min · 917 words · Raul
Tree-Extended, a tool to get custom directories trees

Tree-Extended, a tool to get custom directories trees

[Original Article] In this write, I want to show two ways to create custom directory trees by using the tree-extended tool: By using directly tree-extended in your SO command line by installing it as a node package. Or, by using the tree-extended vscode extension. Why tree-extended? I was documenting one of my projects and I wanted to write in markdown a directory tree representation, but I didn’t want to show all the directories but a particular one, the one that I was talking about in that section in the document. There is a command for Linux named tree that you can install, but it didn’t match all the requirements I was looking for. That is why I created tree-extended as a custom implementation of tree. ...

October 2, 2024 · 4 min · 702 words · Raul
Build Your Personal Website for Free Using React.js

Build Your Personal Website for Free Using React.js

[Original Article] In this article, I want to show you how to create your personal website for free! To get that, we are going to use GitHub Pages, which will allow us to host our website and will even give us a secure (HTTPS) URL. Optionally, we can even use our own domain name; in such a case, it is the only thing that you will need to pay for. As the title says, we want to create the website using ReactJS. ...

October 1, 2024 · 12 min · 2397 words · Raul

My Coding Interview Tarining Schema Intro Explain this schema would work for train for most of coding interviews whiteboards hands 1-1 iterviews Explain most important is way of communication, thinking process, solving problem skills (from gathering requirements to testing and analysis), over just completing the challenge. Im going to give a short preparation process, to train main things to focus, just a couple of problems Interview schema During preparation, every problem you solve, even if you know the solution, or if you’ve already solved it. Try to speak in a loud voice, or if you can’t, just try to simulate you are talking in your head, and explain everything you have in mind. Write in comments every step, as a place holder, to not forget anything. Even in the actual interview you can do so. Steps: /* # 1. Understand the problem # 2. Find edge cases # 3. Propose several solutions # 4. Implementation # 5. Testing # 6. Analysis */ 1. Understand the problem After finishing this step, you should get a real understanding of the problem Ask any clarification questions, even if it seems obvious. Happened to me that after Im implementating I realize the implementation is wrong because I didn’t understand the problem At the end, write a summary for the interviewer to check if you got it correctly Find edge cases Try to find any edge case: Input numbers: 0, negative, long int Arrays: null, empty, fewer items than required Strings: null, empty, fewer chars, weird characters Matrix: empty, null, fewer rows or cols TreeNodes (objects): null, roots, … problematic values depending on the problem specification Propose several solutions Find the brute force, or the first idea come to your mind (try to do it always) Then find a better one, or improve brute force If nothing comes to your mind, just ask for tips or help This is the most critical step

2 min · 318 words · Raul