Push to talk looks like a small feature. Record, send, play. The backend tells a different story, and the whole thing turns on one requirement that sounds impossible the first time you hear it.
The receiver starts hearing the message before the sender has finished recording.
Everything below is a consequence of that one line.
The audio is not a file, it is a stream of fragments
The app pushes fragments over a persistent connection while the microphone is still open. So the server holds partial state for a large number of messages at the same time, and it has to answer a question that has no clean answer from the data alone: is this recording still in progress, or did the phone die three seconds ago?
That question is the actual engineering problem. The audio is the easy part.
Ingest has to be stateless
Every piece of per message state lives in a shared store keyed by message id, so any ingest node can accept the next fragment from any client. The moment ingest keeps something in local memory you cannot scale it horizontally and you cannot restart a node without losing in flight recordings.
Assembly, transcoding, notification fan out and expiry all move to background workers. Nothing that can block goes near the upload path, because the upload path is the one the user feels.
Ordering and idempotency, or you ship duplicate audio
Fragments carry sequence numbers and writes are idempotent. A mobile client on a bad connection will retry, and a retry must not append the same two seconds of audio twice.
Resuming from the last acknowledged sequence is an ordinary code path here, not a recovery script someone runs after an incident. A dropped connection is not an exception, it is a normal Tuesday.
An explicit state machine
recording -> complete -> delivered -> expired \-> failed An explicit completion signal marks a message finished. Abandoned recordings time out on their own and release their storage. Skip this and storage grows forever, quietly, until somebody reads the bill.
The codec choice is a systems decision
The container and codec have to allow decoding a partial stream. Plenty of formats only become meaningful once the final byte lands, and those formats are simply wrong for this job however good they sound. It is a very cheap decision on day one and a very expensive one in month nine.
Retention is a design input, not a policy page
Voice is personal data. Metadata and in flight fragments carry a time to live that matches the retention rule, so deletion happens because the system is built that way, not because a cleanup job remembered to run.
What to monitor
Not CPU. These:
- queue depth and queue age
- ingest latency
- time to first playable byte
- transcoding duration
- storage errors
- expiry backlog
Queue age is the one that warns you first, every single time. Alert on it.
The stack
PHP application tier on AWS, S3 for the audio, SQS for queued work, Couchbase for metadata and in flight fragments with TTLs matching the retention policy, supervised worker daemons, and Zabbix for monitoring.
The part worth keeping
Nobody judges a voice messaging product on its average latency. They judge it on the worst message they sent today. Design for the tail, instrument the tail, and alert on the tail.
Full case study: Push to Talk Backend for a Messaging App


