Skip to content
runward
runward
Product
Who it is for
Trust
Documentation
News
Try it on an example Talk to us

Docs · The doctrine · Section 04

Modular monolith or microservices

The answer is not ideological. It is sequential: start with a well-partitioned modular monolith, then externalize a component as a service only when an objective criterion triggers it.

1 Start with a modular monolith

A hexagonal modular monolith brings together, in a single deployable, a pure domain and its adapters, plus optional sidecars for specialized capabilities. It offers the deployment simplicity, transactional consistency, and iteration speed a team needs at the start, without giving up modularity, since the boundaries are already established by the ports.

2 Externalize a component as a service, on trigger

Since the boundaries already exist, extracting a component into its own process is a local operation, not a rewrite. It is done only when a criterion justifies it. As long as no trigger is reached, splitting into microservices adds operational cost without benefit.

Externalization trigger matrix

Observed triggerResponse
A single instance can no longer handle the loadExternalize the state, then replicate the affected service.
A component has a very different load or cost profileExtract it as a service to size it independently.
A component has its own delivery cycleDecouple it to deploy it separately.
A component must be isolated for resilience or securityExtract it behind a dedicated process boundary.
High availability or multi-region requirementDistributed topology, shared state, load balancing.
None of these criteriaStay with the modular monolith, it is the right default.

Diagram, topology trajectory

MODULAR MONOLITHdefault TARGETED EXTERNALIZATIONon trigger DISTRIBUTEDHA, multi-region domain + portsorchestratorregistry + sidecar(s)1 deployable domain + portsorchestrator extracted serviceload / own cycle orch. 1inst. orch. 2inst. shared state + load balancing replicated services

The special case of multi-agent

Multiplying independent agents is the agentic equivalent of microservices, and calls for the same caution. The form that dominates in production remains the single orchestrator directing specialists (hub and spokes). Distributed multi-agent brings gains on parallelizable tasks, but degrades sequential reasoning and complicates debugging. It is justified for highly parallelizable complexity, not on principle.

A word on emergence, because the term invites confusion and covers two distinct levels. At the inference level, the model's behavior is already emergent: it is the non-deterministic engine that this whole architecture exists to capture and make usable. It is not opposed to anything; it is embraced. The trade-off lies elsewhere, at the topology level: should there be a swarm of self-organizing agents, with no conductor, or a central orchestrator directing specialists? It is there, and only there, that orchestration is chosen. Self-organization promises more autonomy and distributed resilience, but at the cost of predictability, debugging, and traceability, three non-negotiable requirements in regulated operations. Control is therefore kept at the system level, over an engine that is, for its part, left fully emergent, and collective autonomy is opened only through guarded stages.

The rule that decides is a single one, and it is the same for this entire section: stay central as long as everything fits in a single orchestrator process; switch a component, whether delegation, discovery, or budget, to its distributed adapter as soon as it crosses a process, host, language, or trust boundary, and only that component. The shared store that then unlocks multi-instance (Section 07) hosts the discovery registry and the budget allocation registry: a single boundary governs state, budget, and discovery.

Talk to us

Tell us who you are, and we will get back to you.

Your details are recorded by Another Framework, publisher of runward, to get back to you. They are neither sold nor shared, and are deleted three years after our last exchange. To see or delete them: contact@runward.dev.