Split by name or port before traffic forces you to
Updated

One service doing two jobs over one port splits eventually: name-based and port-based separation, done early.
Services grow a second job quietly: the API also serves admin pages, the worker also answers health checks for another team. One port, two masters. The split always comes; doing it early is a migration, doing it late is surgery.
Name or port
Hostnames separate publicly. Distinct names with their own TLS and routing read clearly and scale independently. Best when callers are outside your control.
Ports separate internally. Fast to add behind a proxy, easy to firewall per purpose. Best when you own every client and the proxy.
Hunt hardcoded addresses first. Every fixed URL or port in client code becomes a breakage on split day. Config and discovery before separation.
Worked example: a fictional admin split
The context below is fictional. Fictional API ParcelAPI (fictional) serves public traffic and admin tools from one listener. An admin query slows public responses twice before anyone acts.
The split moves admin to its own hostname with separate limits, after replacing hardcoded URLs with config. Public latency stabilizes; admin gains its own deploy rhythm. The lesson written down: second jobs get their own door early.
Checklist: a clean split
- No hardcoded addresses in any client.
- Separation axis chosen: name for public, port for internal.
- Limits and TLS per separated surface.
- Rollback keeps the old combined path briefly.
Related reading
- Hands on: Name or Port Split.
- The proxy companion: 502 and 503.
Straight answers
Frequently asked questions
Split by hostname or port?
Hostname for user-facing separation with TLS per name; ports for internal services behind a proxy. Both beat one overloaded listener.
When is the right time?
When deploys, scaling or incidents start touching two concerns at once. Earlier is cheaper than during an outage.
What breaks most often?
Hardcoded addresses in clients. Split the server and every hardcoded client breaks the same day.