Skip to content
View Ashfak-Hossain's full-sized avatar
💭
Talk is cheap, show me the Code
💭
Talk is cheap, show me the Code

Block or report Ashfak-Hossain

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Ashfak-Hossain/README.md
Ashfak Hossain Evan. Backend and distributed systems: backends that stay correct under concurrency and fast under load. Dhaka, Bangladesh.

Available now: backend internships and new-grad roles, remote or Dhaka.

Final-year CS student and competitive programmer who builds backends that keep their promises under load.
Each project below proves one guarantee with a test or a load test, not an adjective.

Featured work

EchoAndAura: ticketing for a live-events company in Dhaka. In a load test 200 buyers raced for 100 seats: 100 held, 100 sold out, 0 errors, 0 oversold. The door scanner keeps admitting from a hashed offline list when the signal drops, then syncs the queued scans.

shortn: a distributed URL shortener in Go. Redirect p99 went from 172 ms to 11 ms under the same load after adding nginx upstream keepalive. noOverlap: double-booking made impossible by a PostgreSQL exclusion constraint. 100 concurrent holds on one slot: one 201, ninety-nine 409s.

Live status of echoandaura.com, shortn.ashfak.dev and nooverlap.ashfak.dev: state, uptime and median response time from hourly health checks.

Engineering notes

Problems I found, measured and fixed. Click one to open it.

p99 from 172 ms to 11 ms with three lines of nginx · shortn

Under steady load the median stayed at 1.6 ms but the tail kept growing. The API's own p99, measured server-side, was about 5 ms, so the missing ~167 ms was spent outside the Go process. nginx had no upstream keepalive: it opened a fresh TCP connection to an API container for every request, and TIME_WAIT sockets piled up over the run.

upstream shortn_api { keepalive 64; }      # keep idle connections to the API open
location / {
    proxy_http_version 1.1;                # keepalive needs HTTP/1.1
    proxy_set_header Connection "";        # nginx sends "Connection: close" upstream by default
}

Same 200 req/s, only nginx changed: p99 172 ms → 11 ms, median unchanged. A tail that moves while the median doesn't is a queueing problem, not a compute one. Performance report →

Making a double-booking impossible to write · noOverlap

Check-then-insert has a race that no application code can close: two transactions both see the slot free in the gap between the two statements. So the service stops checking, and the schema makes an overlap unrepresentable:

EXCLUDE USING gist (listing_id WITH =, tstzrange(check_in, check_out, '[)') WITH &&)
  WHERE (status IN ('HELD', 'CONFIRMED'))

The service inserts and turns the rejection into a 409. A hundred simultaneous holds on one slot give one 201 and ninety-nine 409s; repeated a hundred times, 10,000 attempts leave zero overlapping rows in the whole table. The half-open [) range lets a checkout and the next check-in share a day. How it works →

A server that says "busy" instead of falling over · EchoAndAura

Load-tested on two CPU cores pinned to the production server's size. Past about 80 page views a second, requests queued inside Node until the heap filled, and at 220 a second the web process crashed (JavaScript heap out of memory). The fix is load shedding at the edge: Traefik's inFlightReq caps the requests in flight and answers 429 at once instead of queueing them. With any cap the process never crashed, and its memory stayed near 250 MB.

Choosing the cap was the interesting part. A cap of 40 served page views best, but in an on-sale rush it turned away 160 of 200 buyers while 60 seats stayed empty. A cap of 100 still can't crash and lets the whole rush through: 200 buyers, 100 seats, exactly 100 holds, 0 oversold. Load test →

Admitting people at the door with no signal · EchoAndAura

Venue signal fails exactly when a queue forms. The door phone keeps a copy of the event's ticket list, refreshed every minute, with every ticket code stored only as a salted SHA-256 hash. When a scan gets no answer, the phone judges it from that list (admit, already in, cancelled, not on this list), marks the answer "offline" and queues the scan in an outbox. When the signal returns, the outbox syncs oldest first, 50 scans per request, and the server replays each admit as a real check-in. Two gates without signal can both admit one screenshot, so a double entry is recorded and flagged for staff rather than trusted. ADR-034 →

Exactly-once click analytics that never slow a redirect · shortn

A redirect publishes a LinkClicked event to Redpanda and returns; it never waits for analytics. A separate consumer writes each click to Postgres and commits the queue offset in the same transaction as the insert, so a crash or restart can neither lose a click nor count one twice. Architecture →

Toolbox

Languages: Go, TypeScript, C++, SQL, Python, C. Backend: NestJS, Node.js, chi, Express, Prisma. Data and queues: PostgreSQL, Redis, Kafka/Redpanda, BullMQ, MongoDB. Infra: Docker, Kubernetes, Helm, Argo CD, Terraform, nginx, GitHub Actions. Observability: OpenTelemetry, Prometheus, Grafana, Loki, Tempo, k6. Frontend and graphics: React, Next.js, TanStack Query, Tailwind, OpenGL.

Activity

GitHub activity over the last 12 months: contributions, streaks, commits, merged pull requests, stars, a contribution calendar and top languages. Codeforces: current rank and rating, rating history, rated contests, problems solved, and solved problems by rating.

Also on LeetCode · CodeChef · HackerRank

Hiring?

A terminal session. A recruiter runs sudo hire ashfak: access granted, offer letter queued with exactly-once delivery and idempotency key you. Then two recruiters book the same interview slot at the same millisecond: one gets 201 Created, the other 409 Conflict, ashfak is already booked, next free slot Mon 11:00.

ashfak.dev · LinkedIn · X · Stack Overflow · dev.to

Chaos drill: a cartoon monkey unplugs api-2, the load balancer opens the circuit and retries on api-3, Kubernetes restarts api-2 and traffic comes back. Requests lost: 0.
⚠️ do not open in production
INCIDENT 0001 · the 3 a.m. off-by-one                      severity: personal

impact       1 × Wrong Answer on test 47
             1 × developer awake until sunrise
detection    Codeforces, instantly, in red
root cause   for (int i = 0; i <= n; i++)
fix          <=  →  <      (one character, six hours)
lessons      the constraints were in the statement the whole time

action items
  [x] write the test first
  [x] read the constraints twice
  [ ] sleep                                  blocked by: one more contest

Blameless postmortem. The developer has been forgiven. The array has not.

Pinned Loading

  1. codex codex Public

    mindless reasoning

    TypeScript

  2. shortn shortn Public

    Distributed URL shortener — Go · PostgreSQL · Redis · k8s

    Go

  3. CSES-Problem-Solutions CSES-Problem-Solutions Public

    Solutions to the CSES Competitive Programming Problem Set

    C++

  4. LeetCode LeetCode Public

    LeetCode Problems

    C++ 1

  5. LightOJ LightOJ Public

    LightOJ problem solutions

    C++ 2