惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
A
About on SuperTechFans
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
G
Google Developers Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Cloudbric
Cloudbric
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
H
Heimdal Security Blog
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Latest news
Latest news
I
Intezer
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Threatpost
博客园 - 【当耐特】
S
Schneier on Security
P
Privacy International News Feed
G
GRAHAM CLULEY
T
Tenable Blog
AWS News Blog
AWS News Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
博客园 - Franky
Engineering at Meta
Engineering at Meta
美团技术团队
S
Secure Thoughts
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
From Job Scheduling to Real Time Systems: Two HNG Internship Tasks That Stayed With Me
Sumayyah · 2026-06-13 · via DEV Community

If there is one thing HNG internship taught me, it is that software engineering has a way of making simple ideas feel complicated.

A feature can sound straightforward during planning. Everyone nods their heads. The requirements seem clear. You already have an idea of how you want to build it.

Then you start.

A few hours later, you are reading documentation you did not know existed. You are tracing logs through different services. You are questioning decisions that felt obvious when you first made them. And somehow, the problem that looked small has become much bigger than expected.

Somewhere along the way, I stopped focusing on finishing tasks and started paying attention to what they were teaching me. Some taught me new technologies. Others taught me patience. A few of them left a much deeper mark. Not because they went perfectly, but because they completely shifted how I think about building backend systems.

When I look back on the internship, those are the experiences I remember most clearly. Not because they were perfect, but because they forced me to grow.

Dillame Scheduler

When I got to Stage 9 of the internship, our task was a background job scheduler, I thought I knew what I was getting into. A queue, a worker, a retry system. It sounded manageable.

It was not.

Very early, four things changed the whole problem for me. A min heap, a timing wheel, lazy deletion, and priority updates. Put together, they formed the IndexedPriorityQueue, and that became the hardest part of the entire system.

The scheduler itself was meant to be production ready. FastAPI handled the API. MongoDB stored jobs. Redis handled pub sub. A worker process ran separately and executed jobs in the background.

The system supported DAG dependencies, recurring schedules, retry backoff, dead letter handling, starvation prevention, duplicate protection, and a live dashboard. But everything depended on one thing working correctly. The scheduler had to decide which job runs next and when.

That is where things got real.

A simple scheduler can just fetch jobs and sort them. That works until scale enters the picture.

Jobs had multiple factors. Priority, scheduled time, creation time. All of them mattered. And when high priority jobs keep arriving, low priority jobs can easily get stuck forever.

So I had two problems. Ordering and starvation.

Ordering meant getting correct execution without constantly sorting everything. Starvation meant making sure low priority jobs do not get ignored for too long.

That is where I started building the IndexedPriorityQueue.

How I approached it

I used a min heap as the base structure, then extended it with an index map to support updates.

Python heapq does not support priority updates, so I used lazy deletion. Instead of modifying entries, I pushed new ones and marked old ones as stale. When popped, stale entries were ignored.

Each entry followed this structure:

(effective_priority, scheduled_at, created_at)

This gave stable ordering across priority, schedule time, and creation time.

The index map tracked job versions. Every update increased the version, pushed a new heap entry, and invalidated the old one. This kept updates at O log n without rebuilding anything.

The timing wheel handled future jobs. Instead of placing everything in the heap, I used a 3600 slot circular structure. Jobs scheduled within an hour went into the wheel first, then got promoted into the heap when due.

slot = int(scheduled_at.timestamp()) % 3600

This kept the heap focused only on ready work.

What broke and how I fixed it

Lazy deletion caused heap buildup over time. Too many stale entries slowed pops. I fixed it by rebuilding the heap only when stale entries crossed a safe threshold.

Timing drift caused jobs to land in wrong slots. I fixed it by normalizing timestamps before slot calculation and using consistent floor based time everywhere.

Starvation updates sometimes affected MongoDB but not the in memory heap. I fixed it by checking the index before applying heap updates so both stayed in sync.

SSE events failed once due to Nginx buffering. The system was working, but the browser was not receiving updates. Disabling proxy buffering fixed it immediately.

What I took away from it

I learned that data structures stop being abstract the moment state and time enter the picture. A heap is simple until you need updates, persistence, and coordination across workers.

The combination of a timing wheel and heap was the key insight. The wheel handled coarse grained scheduling with O(1) insertion, while the heap handled fine grained execution ordering with O(log n) updates. Separating concerns reduced complexity in both layers.

Most importantly, I learned that debugging distributed systems is about tracing behavior across boundaries, not just looking at one place.

Why I picked it

I picked this task because it exposed everything I did not fully understand at the start.

Everything else in the system felt familiar enough. APIs, databases, queues, dashboards. The scheduler forced deeper thinking.

It was not just about making something work. It was about making it correct under failure, load, and time.

The system is live and running, and the full implementation is available here:
Source Code

Clinsights API - SSE Notification Delivery system & EventBus + connection registry layer

Stage 6 of the internship moved the clinical API from a simple request-response backend into a distributed, event-driven system. The system was split into three major parts: a fault-tolerant processing pipeline, a real-time notification system using SSE, and a WebSocket-based chat layer.

I worked specifically on the SSE Notification Delivery system and the EventBus + connection registry layer, which handled how backend events are delivered to users in real time.

The SSE Notification Delivery system was responsible for pushing updates from the backend pipeline to the client without polling. Instead of the frontend repeatedly calling endpoints like /cases/{id}/interpretations/latest, the backend maintains a persistent connection and streams updates as soon as they happen.

At the center of this design was an EventBus, which acts as a shared communication layer between the pipeline and real-time consumers. The pipeline emits events like interpretation_ready, and the SSE layer subscribes to those events and forwards them to connected clients.

On top of this, a connection registry tracks active user sessions in memory, allowing the system to broadcast events across multiple devices or tabs.

The problem it was solving

The original system had no real-time delivery mechanism. Once a case was processed, the only way for the client to know was to poll the API repeatedly. This created unnecessary load and delayed feedback.

More importantly, there was no structured way for backend events to flow into the client. The pipeline updated database state, but nothing in the system was responsible for translating those updates into real-time user-facing events.

The core problems were:

  • Heavy reliance on polling and repeated API calls
  • No real-time feedback when processing completed
  • No unified event propagation system between backend and frontend
  • No recovery mechanism for missed updates

How I solved it

The first step was introducing an EventBus abstraction as the central communication layer. Instead of tightly coupling the pipeline to delivery systems, the pipeline simply publishes events.

The EventBus handles:

  • Publishing events through Redis pub/sub
  • Subscribing users to event streams
  • Serializing event payloads consistently
  • Acting as the single source of truth for all real-time events

The SSE layer then consumes these events and streams them to clients through a persistent HTTP connection (/notifications/stream).

The connection flow looks like this:

  • Client opens SSE connection
  • Server subscribes user to EventBus channel
  • Pipeline publishes event to EventBus
  • SSE stream receives event and pushes it to client

To support real-world conditions, I also added:

  • Keepalive pings every 30 seconds to prevent proxy timeouts
  • Last-Event-ID support for missed event replay
  • In-memory connection registry for multi-device broadcasting
  • Strict separation between event production and delivery layers

One of the first issues I ran into was missed events during temporary client disconnections. The SSE stream worked perfectly when the connection was alive, but if a user disconnected even briefly, any events sent during that window were lost permanently. This made the system unreliable in practice.

I fixed this by persisting notifications in the database and introducing Last-Event-ID support. On reconnection, the server replays all events that were created after the last received event ID. This turned SSE from a purely live stream into a recoverable event system.

Another issue I faced was SSE connections being silently closed by proxies and load balancers due to inactivity. In production-like environments, long-lived HTTP connections are often terminated if no data is transmitted for a while. This caused unexpected disconnections even when the backend was healthy.

I solved this by introducing periodic keepalive comments every 30 seconds. These small heartbeat messages ensure the connection is always considered active by intermediaries.

I also faced duplicate event delivery during reconnections where replayed events overlapped with live events still in transit. This resulted in duplicate notifications on the frontend. The fix was to assign stable event identifiers tied to database records, allowing the client to safely deduplicate events.

Finally, there was a design-level issue where different parts of the system were emitting events inconsistently. The pipeline, SSE layer, and WebSocket system were initially loosely coupled, which made behavior unpredictable. I resolved this by enforcing the EventBus as the only valid event source. Everything else subscribes to it, nothing bypasses it.

What I took away from it

This system made it clear that real-time infrastructure is not just about sending data quickly, but about guaranteeing delivery under failure conditions.

A few key lessons stood out which includes,

  • Event-driven systems only work when there is a single, consistent event source
  • SSE is simple but requires persistence and replay to be production-safe
  • Connection state cannot be trusted; it must always be treated as temporary
  • Real-time delivery is less about pushing events and more about recovering them correctly The most important realization was that reliability in distributed systems comes from designing for failure first, not adding it later actually.

Why I picked it

I worked on this part because it sat at the intersection of backend processing and user experience. It was not just infrastructure for the sake of infrastructure, it was directly controlled how users experienced system responsiveness.

It also involved solving coordination problems between multiple moving parts: the pipeline, the EventBus, and the real-time delivery layer. Getting all of them to behave consistently required thinking beyond individual services and focusing on system-wide behavior.

That made it one of the most technically interesting parts of the project to work on.

Final thoughts

What stayed with me from both projects was not the features, but the systems behind them.

One taught me how to control execution under uncertainty, where timing, queues, and concurrency decide correctness. The other taught me how to move information reliably in real time, across connections that can appear and disappear at any moment.

In both cases, the real challenge was not making things work. It was making them keep working when everything around them gets noisy, fast, or unpredictable.

That is the part I will remember most.

Thank you HNG!