So, mostly, today, I was debugging. One of the unusual bugs that I encountered today had to do with a closed network socket. The setup I was working with had two file-serving containers. Now, what happens if one of the two servers fails? What happens to the client end that was fetching data, or to the new client that is going to get routed to the broken server? The system should be capable of self-healing. In a sense, the file(s) should continue to be served.
One place where you can set up a health check on your file servers is at the routing stage. The routing stage in my setup is a stage where a client requests a file and then gets provided with a unique address of the CD (Content Delivery) server. The central server then makes sure the CD server is live before forwarding its address to the client in need. Well, easier said than done tbh.
To check if this was working like I just said, I purposely shut down one of the two servers. The central server was supposed to see that the server was down and order the second server to download all the files that were cached by the first server from S3 object storage. Well, that didn't happen. It was instead throwing ClosedChannelException at my face.
It took me a while to notice that it was an IO exception caused by a nonexistent socket (port), which shouldn't be handled by the global Exception handler. This exception should indeed be taken as a negative of the health check. Putting it inside a try-and-catch block was the answer.
Well, lesson learned!!!!!
One place where you can set up a health check on your file servers is at the routing stage. The routing stage in my setup is a stage where a client requests a file and then gets provided with a unique address of the CD (Content Delivery) server. The central server then makes sure the CD server is live before forwarding its address to the client in need. Well, easier said than done tbh.
To check if this was working like I just said, I purposely shut down one of the two servers. The central server was supposed to see that the server was down and order the second server to download all the files that were cached by the first server from S3 object storage. Well, that didn't happen. It was instead throwing ClosedChannelException at my face.
It took me a while to notice that it was an IO exception caused by a nonexistent socket (port), which shouldn't be handled by the global Exception handler. This exception should indeed be taken as a negative of the health check. Putting it inside a try-and-catch block was the answer.
Well, lesson learned!!!!!
Guess who called an Async method inside a @Transactional annotated method of the same class? It is I 😑. Don't do it you are in for database inconsistencies you are not ready for. I feel like I have to rant about inversion control proxies for a bit.
I wrote these articles a while back, and this week I will be working on the actual implementation. I will be sharing the progress at each step, along with the hurdles I face. It will get a bit DSA‑ish, so if you're interested, tune in.
https://axumawi.hashnode.dev/gauging-a-file-serving-server-s-traffic-load-using-a-sliding-window
https://axumawi.hashnode.dev/managing-storage-and-load-balancing-in-a-distributed-file-server
https://axumawi.hashnode.dev/gauging-a-file-serving-server-s-traffic-load-using-a-sliding-window
https://axumawi.hashnode.dev/managing-storage-and-load-balancing-in-a-distributed-file-server
kaleab tesfaye
Tracking Server Traffic with a Sliding Window
track high-volume server traffic using a sliding window algorithm, Unix timestamps, and Mutex locks to prevent concurrency bugs.
Was working on this project that I wanted to move fast, and I decided to use "agentic development." I wouldn't even call it vibe coding; I knew everything that had to be built prior, but I wrote less code. And I can say with absolute certainty that AI is still not that good. And I don't even know what the hype is about anymore.
The feature that I asked the AI to build, which it couldn't do all day long, was this:
So, when a user wants to upload an image, it asks the central server for an upload slot. The server authenticates the request for proper authorization, and then generates A UUID name for the file and an upload ticket, saves the ticket and the generated UUID name in a memory cache, in my case, Caffeine (but in production will be Redis), and then sends the generated UUID name and the upload ticket back to the client. The client then uploads the file to an nginx server. For now, there is no custom file system; nginx just stores it in a shared Docker volume. But before accepting the put methods sent by the client, it (Nginx) forwards the UUID (name) + Upload Ticket to the central server for auth. The central server then checks the cache for the specific key entry <Upload Ticket, UUID> after making sure the ticket is valid, and also that the file name the client is uploading is the same as the one stored in memory.
That was it; not in a single universe is that a complex spec to implement, which the AI failed to do.
I just gave up on it now, and I'm gonna have to go through the slop and fix it myself. It would have been better if I wrote the implementation myself. I genuinely don't know how people are making anything that is serious with AI.
(or am I a dumb 🥷🏿 who doesn't know how to properly prompt "iA"?)
The feature that I asked the AI to build, which it couldn't do all day long, was this:
So, when a user wants to upload an image, it asks the central server for an upload slot. The server authenticates the request for proper authorization, and then generates A UUID name for the file and an upload ticket, saves the ticket and the generated UUID name in a memory cache, in my case, Caffeine (but in production will be Redis), and then sends the generated UUID name and the upload ticket back to the client. The client then uploads the file to an nginx server. For now, there is no custom file system; nginx just stores it in a shared Docker volume. But before accepting the put methods sent by the client, it (Nginx) forwards the UUID (name) + Upload Ticket to the central server for auth. The central server then checks the cache for the specific key entry <Upload Ticket, UUID> after making sure the ticket is valid, and also that the file name the client is uploading is the same as the one stored in memory.
That was it; not in a single universe is that a complex spec to implement, which the AI failed to do.
I just gave up on it now, and I'm gonna have to go through the slop and fix it myself. It would have been better if I wrote the implementation myself. I genuinely don't know how people are making anything that is serious with AI.
(or am I a dumb 🥷🏿 who doesn't know how to properly prompt "iA"?)
was working on this today, and thought it would really be helpful if i share it.
it will walk you throw on how to talk with the "hidden" CBE's api and then access transactional Json payload.
https://axumawi.hashnode.dev/build-your-own-lightweight-cbe-payment-verification-service
it will walk you throw on how to talk with the "hidden" CBE's api and then access transactional Json payload.
https://axumawi.hashnode.dev/build-your-own-lightweight-cbe-payment-verification-service
kaleab tesfaye
Build Your Own Lightweight CBE Payment Verification Service:
So, I was working on this project, where the client’s customers made their payments through CBE, and one of the services I had to build was one that verifies those payments. And I thought I would shar
I now know why old Java was hated so much. No one gets paid enough to maintain corporates' legacy corpus.
a must watch:
https://www.youtube.com/watch?v=C3-FIM2xTIw
https://www.youtube.com/watch?v=C3-FIM2xTIw
YouTube
The Most Copied Design in Distributed Storage: Google File System
In this video, we take a look at the Google File System (GFS), how Google stores petabytes of data across thousands of commodity machines using chunkservers, a single master, 3-way replication, health checks, ...
Questions: tajpouria.dev@gmail.com
My GitHub:…
Questions: tajpouria.dev@gmail.com
My GitHub:…
......in the long run I almost lose nothing. If AI becomes drastically better than what it is now, prompting a model to do what you want is not hard...I will adapt, so I won't struggle to shift ( I highly doubt AI models will get that better from now on; the underlying model.) But, above all, I love programming lol. I didn't choose the field I am in, just for the money, it was also because I am passionate about it. When I say "forever" it is backed by the fact that Coding models are meh at best, expensive asfk, and take the fun out of something I genuinely love doing.