Edgex
25.4K posts

Edgex
@SahilExec
Backend engineer and lurker | DSA | CSE'28 | DM for collab
127.0.0.1 Katılım Ekim 2025
525 Takip Edilen4K Takipçiler

@avrldotdev Oof, that interview was a trap. I'd shard by hash, run parallel workers with a Bloom filter for quick checks, then merge – should stay under 2 seconds.
English

@avrldotdev Totally agree people still brag about stars like it’s a badge of honor, but it tells you nothing about real impact.
English
Edgex retweetledi

How do you maintain agreeability between separate servers spread across network?
The answer is consensus algorithm with leader follower relationship.
My last project "graft" was written to understand these things.
The architecture was to have 3 nodes running with Raft & have a gateway service which forwards request to the leader of the cluster from the client.
To deploy and manage all of this, I used kubernetes statefulset for the raft cluster (the 3 nodes) and a gateway deployment with a headless service alongside it.
Each raft node has a postgres instance to act as a state machine (KV & metadata) with a dedicated persistent volume to store the append-only log to store the commands.
The gateway service is leader aware, before any request is made, it fetches the current state of the raft cluster, updates itself and then send the request.
The other way couldve been that gateway would send to the peer node it think is the leader, but if it isn't, the peer would forward the request to the leader internally & the response to the gateway contains the new leader metadata & it would update it.
I went with the first approach to keep things separate & simpler. But I believe the second approach scales better.
I also made every request idempotent, each req has a reqID & stored in an appliedreqid table in postgres. If you keep sending the same reqID with different requests, the leader will just return 200 OK with a no-op.
This keeps things from overwriting or double-applying when there's an inconsistency or client retries on a failure, realised this was important when i weote my harness.
So the harness is pretty simple, i port forwarded each node & gateway, ran different scenarios on it & asserted the expected behaviour.
Some scenarios were to write multiple times with same reqid & confirm only the first req was applied. Write to a leader & kill it, then see if the followers replicated the write or not, etc. You can think of many others.
I am documenting all of this in the github readme (its outdate rn), ao you can understand what I did, and can file an issue if you think I made a mistake too :)
Hope this helps!

English








