Skip to content
Muhammet Şafak
tr

Just Ask

Ask me anything

Ask me anything about software architecture, careers, PHP, Go and the craft of building software; I answer here, in the open, for everyone. (Page 4/6)

Ask a question

Whatever's on your mind, don't hold back. Questions reach me directly; I answer the good ones and publish them on this page. Your email is never published.

Your email only reaches me and is never published.

Serkan

How do I prevent log storms and disk-full outages?

Fix both layers: throttle/sample repetitive logs in the app ('×10,000' as one line) and back off retries; on the host use logrotate with size/count caps and write logs to a dedicated volume, not the root disk. Treat unbounded logging as a bug.

#resilience#observability#infrastructure
Hakan

Graceful degradation: how do I isolate non-critical services under load?

Decide in advance what's critical (browse, cart, checkout) and what's nice-to-have (recommendations, similar products, reviews); put the nice-to-haves behind feature flags and short timeouts. Under load a kill-switch turns them off or serves mock data. Don't improvise at 98% CPU — rehearse first.

#resilience#architecture#scaling
Volkan

How do I prevent PostgreSQL split-brain with quorum and consensus?

Let a node be primary only if it holds a majority (quorum). Don't hand-roll failover; use Patroni + etcd/Consul (Raft), and have the old primary cut off from the quorum demote itself (fencing). Use an odd number of voting members.

#resilience#postgresql#database
Tunç

How do I set up a Circuit Breaker for a flaky third-party API dependency?

Stop calling a failing dependency: count failures while CLOSED, fail fast to a fallback while OPEN, probe with trial calls while HALF-OPEN. But the real killer is the 30s timeout — pair the breaker with a short timeout, a bulkhead and a fallback.

#resilience#architecture#laravel
Aslı

How do I set up CDN asset versioning: hashing and a cache strategy on deploy?

Query-string busting is unreliable — some CDNs ignore the query in the cache key. The robust pattern is content-hashed filenames (`app.a8f9b2.js`): the name changes only when content changes, so you cache forever with `immutable`. The one thing you must never cache long is the HTML that points to those hashes.

#performance#ci-cd#infrastructure
Barış

How do I stream 2-5 GB file downloads without blowing up PHP's memory?

`file_get_contents`/`Storage::get` loads the whole file into RAM — fatal at 2-5 GB. Best of all, don't pipe the bytes through PHP: a presigned S3 URL or `X-Sendfile`. If you must, use `Storage::readStream` + `StreamedResponse` and emit chunk-by-chunk so memory stays flat at a few MB.

#performance#laravel#infrastructure

Search the site

Start typing to search posts, projects and pages.

Esc to close Powered by Pagefind