MuleSoft

MuleSoft Mastery: From Zero to Hero | Ch.08

From a working API to a resilient, self-healing production platform — CloudHub 2.0 private spaces, Runtime Fabric on your own Kubernetes, multi-AZ availability, clustering, autoscaling, and zero-downtime rollouts…

MuleSoft Mastery: From Zero to Hero | Ch.08
Chapter 08 · MuleSoft from Zero to Hero

From a working API to a resilient, self-healing production platform — CloudHub 2.0 private spaces, Runtime Fabric on your own Kubernetes, multi-AZ availability, clustering, autoscaling, and zero-downtime rollouts that survive a data-center outage.

SeriesMuleSoft Zero → Hero Chapter08 of 12 PublishedApr 17, 2026 Read~30 min CloudHub2 RuntimeFabric HighAvailability Clustering Autoscaling

In Chapter 7 you took a working Customer API and turned it into a governed asset — policies, SLA tiers, Flex Gateway, and a CI/CD pipeline. But governance is only half of production. The other half is resilience: what happens when an availability zone drops, when traffic triples on Black Friday, or when you have to ship a breaking change to a live API serving millions of requests. This chapter is your complete tour of the runtime side of MuleSoft — where your apps actually run, and how to keep them running.

Companion source code

The companion repo carries a complete deployment scaffold for this chapter — a pom.xml with the cloudHub2Deployment config, a clustering-enabled deployment example, a Runtime Fabric values.yaml, an Anypoint MQ reliability pattern, and the full multi-region disaster-recovery topology used in the case study.

github.com/nestaconnect/mulesoft-from-zero-to-hero

By the end of this chapter you will:

  • Compare CloudHub 1.0, CloudHub 2.0, and Runtime Fabric — and pick the right one with confidence
  • Understand CloudHub 2.0 architecture: private spaces, replicas, vCore sizing, and intelligent healing
  • Run Mule on your own Kubernetes with Runtime Fabric — controllers, workers, and the agent
  • Design for high availability across availability zones — and know HA from clustering
  • Scale horizontally with replica scale-out and Horizontal Pod Autoscaling
  • Handle state and messaging correctly — why persistent VM queues are gone on CloudHub 2.0
  • Ship zero-downtime updates with rolling, blue-green, and canary strategies
  • Plan disaster recovery and a multi-region topology — and understand what MuleSoft does not give you out of the box
  • Monitor and alert on the metrics that actually predict incidents

01 · The Landscape — Where Can a Mule App Actually Run?

MuleSoft’s deployment options sit on a spectrum that trades convenience against control. At one end, you hand everything to MuleSoft and never think about infrastructure. At the other, you run Mule on your own Kubernetes cluster and own every layer. The art is knowing which trade-off your project actually needs — most teams over-estimate how much control they require.

DEPLOYMENT SPECTRUM · CONVENIENCE ↔ CONTROL ← more managed by MuleSoft more control for you → CLOUDHUB 1.0 legacy · shared workers Multi-tenant VMs Simple, ageing Migrate off it ☁ CLOUDHUB 2.0 fully managed iPaaS Kubernetes containers Zero infra ops 12 regions · self-healing most teams start here 🏗 RUNTIME FABRIC your Kubernetes EKS · AKS · GKE OpenShift · bare metal data sovereignty 🖥 HYBRID your servers Mule agent on-prem / legacy you own it all
Four runtimes, one spectrum. CloudHub 2.0 and Runtime Fabric both run on Kubernetes under the hood — the real difference is who operates the cluster. Start at CloudHub 2.0 and only move right when a hard requirement forces you to.
PlatformRuns onYou manageBest for
CloudHub 1.0Multi-tenant VMs (workers)Almost nothingLegacy only — plan your migration
CloudHub 2.0MuleSoft-managed KubernetesJust your app + private space configThe default for most enterprise workloads
Runtime FabricYour EKS / AKS / GKE / OpenShiftThe Kubernetes clusterData sovereignty, hybrid cloud, existing K8s
Hybrid / on-premYour own servers + Mule agentEverythingAir-gapped, legacy proximity, sunset paths
The key shift

Both CloudHub 2.0 and Runtime Fabric are Kubernetes-based. That means the same mental model — pods, replicas, horizontal scaling, rolling updates — applies whether MuleSoft runs the cluster or you do. Learn the concepts once on CloudHub 2.0, and they transfer directly to Runtime Fabric. CloudHub 2.0 architecture →

02 · CloudHub 2.0 — The Managed Runtime, Up Close

CloudHub 2.0 gives you a fully managed, containerized runtime. Each environment runs inside a private space — a virtual, private, isolated logical space in which your Mule apps run, with its own IP ranges, VPC connectivity, and firewall rules. Inside a private space you deploy applications, and each application runs as one or more replicas — dedicated instances of the Mule runtime engine, each in its own container.

CLOUDHUB 2.0 · PRIVATE SPACE ARCHITECTURE PRIVATE SPACE · EU-WEST-1 · isolated VPC + firewall ⚖ INGRESS LOAD BALANCER built-in · HTTP routing AVAILABILITY ZONE A Order API replica-1 (pod) 0.2 vCore Customer API replica-1 (pod) 0.5 vCoreeach pod = one isolated Mule runtime self-healing: crashed pod is restarted automatically AVAILABILITY ZONE B · 60+ miles apart Order API replica-2 (pod) 0.2 vCore redundant by default platform services have ≥1 layer of redundancyif AZ A fails, AZ B keeps serving traffic — no action required
A single private space, two applications, replicas spread automatically across two availability zones at least 60 miles apart. You don’t toggle multi-AZ — for multi-replica apps it’s the default.

2.1 · Replicas and vCore sizing

You scale a replica vertically by choosing a vCore size, and horizontally by adding more replicas. Bigger vCore sizes give more CPU, heap, and ephemeral storage. Replicas below 1.0 vCore are burstable (they can briefly borrow CPU when available); replicas at 1.0 vCore and above give consistent performance.

vCore sizevCPUHeapTotal memoryStorage
0.10.1 (burstable)~0.6 GB1.2 GB8 GB
0.20.2 (burstable)1 GB2 GB8 GB
0.50.5 (burstable)1.3 GB2.6 GB10 GB
1.01 (consistent)2 GB4 GB12 GB
2.02 (consistent)4 GB8 GB40 GB
4.04 (consistent)7.5 GB15 GB88 GB
Granular, not all-or-nothing

Unlike CloudHub 1.0’s jump from 0.2 to 1.0, CloudHub 2.0 offers granular increments — 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, and 4.0 vCores per replica — so you size to the workload instead of over-paying. The metaspace limit is fixed at 256 MB regardless of replica size. Note: stopped applications don’t count toward your vCore usage, but deployed-and-running ones do. Replica sizing →

2.2 · Deploying to CloudHub 2.0 with Maven

You can deploy from Anypoint Studio, from Runtime Manager, or — the only sane choice for production — from a pipeline using the Mule Maven Plugin. Always pin an LTS runtime (Mule 4.6 LTS or later) and set a rolling update strategy for zero downtime.

XML — pom.xml · CloudHub 2.0 deployment with HA + rolling updates
<plugin>
  <groupId>org.mule.tools.maven</groupId>
  <artifactId>mule-maven-plugin</artifactId>
  <version>4.2.0</version>
  <extensions>true</extensions>
  <configuration>
    <cloudHub2Deployment>
      <uri>https://anypoint.mulesoft.com</uri>
      <environment>Production</environment>
      <target>private-space-eu-west-1</target>
      <muleVersion>4.6.14</muleVersion>          <!-- LTS -->
      <applicationName>order-api-prod</applicationName>
      <replicas>2</replicas>                         <!-- HA across AZs -->
      <vCores>0.5</vCores>
      <deploymentSettings>
        <updateStrategy>rolling</updateStrategy>   <!-- zero downtime -->
        <clustered>false</clustered>            <!-- HA, not clustering -->
      </deploymentSettings>
      <properties>
        <mule.env>production</mule.env>
      </properties>
      <secureProperties>
        <db.password>${DB_PASSWORD}</db.password>  <!-- encrypted at rest -->
      </secureProperties>
    </cloudHub2Deployment>
  </configuration>
</plugin>

03 · Runtime Fabric — Your Kubernetes, MuleSoft’s Management

Runtime Fabric (RTF) lets you run Mule applications and API gateways on your own Kubernetes, while Anypoint Platform stays the control plane. Your data never leaves your infrastructure — the perfect fit for data-residency requirements, hybrid cloud, or teams who already live in Kubernetes. RTF comes in two flavours:

  • RTF on Self-Managed Kubernetes — you install the RTF agent into an existing cluster: Amazon EKS, Azure AKS, Google GKE, Red Hat OpenShift, or Rancher (RKE). You own the cluster lifecycle.
  • RTF on VMs / Bare Metal — MuleSoft ships the full appliance (Docker + Kubernetes packaged together) and you install it on VMs you operate. MuleSoft maintains the appliance components.
RUNTIME FABRIC · CONTROL PLANE ↔ YOUR CLUSTER ANYPOINT CONTROL PLANE SaaS · US or EU ⚙ Runtime Manager 🛡 API Manager 📊 Anypoint Monitoring defines desired state; never touches K8s directly mTLS outbound only YOUR KUBERNETES CLUSTER · EKS / AKS / GKE RTF Agent event-driven pod Controller nodes orchestration · ≤5 Ingress controller you provide it WORKER NODES · run Mule app pods (≤16) Pod · replica-1 Mule + JVM app container + monitoring Pod · replica-2 Mule + JVM isolated runtime per app Persistence GW Object Store → PostgreSQL survives restarts Kubernetes schedules & reschedules pods · the agent reports state changes upstream Your traffic and data stay entirely inside your cluster
The control plane lives in Anypoint’s SaaS; the data plane lives in your cluster. The RTF agent opens a single outbound mTLS connection, reports application state, and applies whatever the control plane asks for — it never exposes your cluster inbound.
RTF realities to plan for

Runtime Fabric has no native Object Store — for state shared across replicas you use the Persistence Gateway, which backs Object Store with a PostgreSQL database you provide. Apps must exist in Exchange before they can be deployed to RTF, so your CI/CD differs from CloudHub. You provide and operate the ingress controller, DNS, and load balancers yourself. Runtime Fabric overview →

04 · High Availability — Surviving a Zone Outage

High availability means your application keeps serving even when something fails. On CloudHub 2.0 and Runtime Fabric, HA comes from redundancy. The single most important fact: when you deploy with two or more replicas, the platform automatically distributes them across two or more availability zones. If one zone has an outage, the replicas in the other keep handling traffic — and you didn’t configure anything special to get it.

But there’s a subtle, frequently-misunderstood distinction between plain HA and clustering, and choosing wrong causes real bugs (double-fired schedulers, lost object-store data).

HIGH AVAILABILITY vs CLUSTERING HIGH AVAILABILITY · replicas don’t share data replica-1 own memory AZ A replica-2 own memory AZ B ✗ no shared state schedulers fire on EVERY replica object store NOT visible across pods Best for: stateless APIs & idempotent flows CLUSTERING · replicas share memory primary runs scheduler AZ A secondary warm standby AZ B ✓ shared memory + VM queues scheduler fires ONCE (on primary) automatic failover to secondary Best for: stateful / single-run processing Enable clustering only when you need it — it adds coordination overhead. Most APIs are happiest as plain HA.
Plain HA gives you independent, redundant replicas — perfect for stateless APIs. Clustering links replicas into one logical unit that shares memory, so a scheduler fires exactly once. Pick clustering only when correctness depends on shared state.

4.1 · Replica scale-out limits

You can deploy an application with up to 8 replicas — or up to 16 replicas if your organization has the Anypoint Integration Advanced package or a Platinum/Titanium subscription. Mule automatically distributes those replicas across two or more data centers for maximum reliability. When you enable clustering, MuleSoft recommends scaling a cluster to no more than 8 nodes.

A gotcha worth memorizing

Batch jobs run on a single replica at a time and cannot be distributed across replicas. If the running app is updated mid-batch, the remaining batch work does not continue. For durable batch state on CloudHub 2.0, externalize to Object Store v2. Schedulers in a non-clustered multi-replica app fire on every replica — either enable clustering or make the flow idempotent. Clustering docs →

05 · Scaling — Manual, Automatic, and the Catches

Scaling on CloudHub 2.0 happens two ways. Manual scaling: in Runtime Manager you adjust replica count and vCore size at any time — new replicas are provisioned on scale-up, and traffic is drained before termination on scale-down. Autoscaling: under the hood, Kubernetes uses a Horizontal Pod Autoscaler (HPA) that adds or removes replicas to match demand, so an application can move to a new replica without any user action.

Before you crank the replica count, internalize the four things that bite teams in production:

ConsiderationWhy it mattersWhat to do
Stateless vs statefulStateless apps scale linearly; stateful apps need shared stateExternalize state to Anypoint MQ or Object Store v2
Connection poolsEach replica opens its own pool to the backend10 replicas × 20 conns = 200 — size the DB for the total
Schedulers & batchFire on every replica (non-clustered); batch is single-replicaCluster, or make flows idempotent
vCore licensingOrg-level vCore cap enforced across CloudHub + CloudHub 2.0You can deploy but not start apps if you’re over the cap

06 · State & Messaging — Why Persistent VM Queues Are Gone

This is the section that trips up engineers migrating from CloudHub 1.0, so read it twice. CloudHub 2.0 does not support persistent VM queues. The in-memory VM connector still works for transient, intra-app communication, but if you relied on persistent VM queues for reliable, restart-surviving messaging, you must refactor to a real message broker.

The migration that surprises everyone

Persistent VM queues are not available on CloudHub 2.0. To get reliable, persistent messaging, move to an external broker: Anypoint MQ, JMS (ActiveMQ/IBM MQ), Apache Kafka, or RabbitMQ. As soon as a message lands in the broker, a subscriber in your app processes it — no in-flight data is lost across restarts or redeploys. If a scheduler triggers the flow, enable clustering so only the primary fires it. Transition guide →

For shared application state (not messages), CloudHub 2.0 uses Anypoint Object Store v2 (OSv2) — a managed store for things like idempotency keys, OAuth tokens, and watermark values. Two facts you must design around:

  • OSv2 is regional. It runs in the same region as your app and provides no cross-region failover. An app in another region cannot read it.
  • Object stores are not shared between non-clustered replicas. Write to one replica and the others won’t see it — unless you use the cloud object store (OSv2) or enable clustering.

On Runtime Fabric, the equivalent is the Persistence Gateway, which persists Object Store data to a PostgreSQL database so state survives restarts and is shared across replicas.

XML — reliable messaging on CloudHub 2.0 with Anypoint MQ (not VM queues)
<!-- Publish reliably to a durable broker queue -->
<flow name="order-intake">
  <http:listener config-ref="https-listener" path="/orders"/>
  <anypoint-mq:publish config-ref="amq-config" destination="orders-queue"/>
  <ee:transform> <!-- 202 Accepted --> </ee:transform>
</flow>

<!-- A subscriber processes independently; survives restarts & redeploys -->
<flow name="order-processor">
  <anypoint-mq:subscriber config-ref="amq-config" destination="orders-queue"/>
  <flow-ref name="persist-order"/>
</flow>

07 · Zero-Downtime — Shipping Without Interruptions

CloudHub 2.0 supports updating applications at runtime so users of your HTTP APIs experience zero downtime. You choose a deployment model: Rolling update keeps the old version serving while the new one deploys, then cuts over — the production default. Recreate stops the old version first (faster, but a brief outage) — only for non-critical apps.

For changes that need careful validation, two classic patterns layer on top — implemented at the gateway/router level, not inside your app.

BLUE-GREEN & CANARY · ROUTER-LEVEL CUTOVER CANARY · weighted shift 👤 Proxy weighted v1 (current) 95% traffic v2 (canary) 5% → watch errors ramp 5 → 25 → 50 → 100% as metrics stay green BLUE-GREEN · instant switch 👤 Router flip target Blue (standby) instant rollback Green (live) 100% traffic rollback = flip the router back to Blue Implement via an API proxy / load balancer with weighted routing. API Manager has no built-in canary — pair it with a smart proxy (NGINX) or a tool like Flagger.
Rolling updates handle the everyday case for free. Blue-green gives instant rollback for risky releases; canary de-risks by sending a small slice of traffic to the new version first. Both live at the router, so your app stays simple.

08 · Disaster Recovery — The Multi-Region Truth

Here’s the honest version that most tutorials skip: CloudHub 2.0 does not provide multi-region HA or disaster recovery out of the box. Availability is provided within a single region — replicas spread across availability zones, with a platform SLA of 99.95% for replicas in an active-active configuration in that region. If an entire AWS region fails, every replica, private space, ingress, and Anypoint MQ destination in that region becomes unavailable, and they are not automatically replicated elsewhere.

Cross-region resilience is something you architect. The pattern: deploy the app in two regions, put a global load balancer in front, and replicate the database across regions.

MULTI-REGION DR · YOU BUILD THIS 🌍 GLOBAL LOAD BALANCER e.g. Route 53 · latency / health routing REGION · US-EAST (primary) private space · multi-AZ replica ×3 Aurora Global DB primary writer SLA 99.95% within region REGION · EU-WEST (failover) private space · multi-AZ replica ×3 Aurora Global DB read replica → promote promoted on US outage cross-region replication · RPO < 1sKeep apps stateless or use globally-distributed state. Anypoint MQ standard queues support cross-region failover for messages.
Multi-region is a topology you assemble from a global load balancer, two regional deployments, and cross-region database replication. CloudHub 2.0 gives you rock-solid HA inside a region; spanning regions is your design responsibility.
Note on a regional outage

If the US East region fails, it’s not just your replicas — Anypoint Platform services like Access Management and Runtime Manager can be affected too, because parts of the control plane run there. Factor that into your runbook: your DR plan can’t assume the console is reachable during a US-East incident. CloudHub 2.0 HA & DR →

09 · Monitoring — Know Before Your Users Do

Anypoint Monitoring is enabled by default for CloudHub 2.0 and Runtime Fabric applications. It gives you dashboards for throughput, error rates, response-time percentiles, and CPU/memory per replica — plus log search by correlationId and custom business metrics. The trick isn’t collecting data; it’s alerting on the signals that actually predict an incident.

AlertTriggerThresholdResponse
Error spike5xx rate above baseline> 5% over 5 minPage on-call, check the most recent deploy
P95 latency95th-percentile response time> 2s over 10 minInspect DB slow queries and upstream APIs
Replica memoryReplica heap/total memory> 80% for 15 minLarger vCore size or hunt a memory leak
Replica restartsSelf-healing restart count> 2 in 10 minCrash loop — pull the thread/heap dump
Queue backlogAnypoint MQ in-flight depthGrowing & not drainingScale out consumers; check downstream
Faster incident triage

CloudHub 2.0 lets you run thread dumps and heap dumps on a specific replica to debug performance issues in real time, and the MuleSoft diagnostics agent can analyze them with Einstein to return a plain-English diagnosis — collapsing your Mean Time To Resolve. Always instrument flows with a correlationId so a single request is traceable end-to-end across replicas. Anypoint Monitoring docs →

10 · Case Study — OmniShop — Resilient Orders at Global Scale

Let’s make it concrete. OmniShop, a global online retailer, runs an Order Management API that processes millions of orders a day. It must survive an availability-zone failure, absorb Black-Friday spikes, and ship updates without dropping a single order. Here’s how they assembled it from the building blocks in this chapter — and what they consciously chose not to rely on MuleSoft for.

OMNISHOP · AZ FAILOVER SEQUENCE 1 · NORMAL 3 replicas, 2 AZs orders → Anypoint MQ OSv2 idempotency keys all green 2 · AZ-A OUTAGE 2 replicas in AZ-A drop LB stops routing to AZ-A queued msgs preserved no orders lost 3 · SELF-HEAL AZ-B replica serves all platform restarts pods capacity restored zero downtime Anypoint MQ keeps in-flight orders durable; OSv2 idempotency keys prevent duplicate processing on retry.
An AZ outage becomes a non-event: the load balancer reroutes, the surviving replica keeps serving, and the platform heals the lost pods — while Anypoint MQ guarantees no in-flight order is lost.

10.1 · The architecture, decision by decision

RequirementDecisionWhy
Survive an AZ failure3 replicas, plain HA (no clustering)Auto-distributed across AZs; the API is stateless
No lost ordersAnypoint MQ, not VM queuesPersistent VM queues don’t exist on CloudHub 2.0
No duplicate ordersIdempotency keys in Object Store v2Safe retries after a failover
Black-Friday spikesHPA autoscaling on CPUAdds replicas automatically, drains on scale-down
Ship without downtimeRolling updates + canary via proxyOld version serves until the new one is healthy
Regional outageSecond region + Route 53 + Aurora Global DBCloudHub 2.0 isn’t multi-region OOTB — built in-house
The outcome

Over the year OmniShop sustained 99.95%+ availability within their primary region, rode out two AZ-level disruptions with no customer-visible impact, and shipped 40+ production deployments with zero downtime via rolling updates. The cross-region failover — exercised quarterly in a game-day — kept order loss under a one-second RPO by promoting the Aurora read replica and shifting Route 53 to EU. None of it was magic; all of it was the building blocks in this chapter, assembled deliberately.

11 · Recap — What You Now Know

01 · CLOUDHUB 2.0 ☁

Managed, containerized runtime

Private spaces, replicas in their own containers, granular vCore sizing, and self-healing. Twelve regions, zero infrastructure to operate.

  • Private space = isolated VPC + firewall
  • Replicas auto-spread across AZs
  • vCore 0.1 → 4.0, granular increments
  • Intelligent healing restarts crashes
02 · RUNTIME FABRIC 🏗

Mule on your own Kubernetes

Self-managed (EKS/AKS/GKE/OpenShift) or VMs/bare-metal appliance. The agent connects outbound over mTLS; your data never leaves.

  • Controllers + workers + RTF agent
  • Persistence Gateway → PostgreSQL
  • Apps must live in Exchange first
  • You own ingress, DNS, the cluster
03 · HIGH AVAILABILITY ⚡

HA is not clustering

Multi-replica = automatic multi-AZ. HA replicas are independent; clustering shares memory so a scheduler fires once. Choose deliberately.

  • Up to 8 replicas (16 with Advanced/Platinum)
  • Clusters: ≤ 8 nodes recommended
  • Batch runs on a single replica
  • Data centers ≥ 60 miles apart
04 · STATE & MESSAGING 📨

No persistent VM queues

Refactor to Anypoint MQ, Kafka, or JMS for durable messaging. Object Store v2 for shared state — but it’s regional with no failover.

  • Persistent VM queues gone on CH 2.0
  • OSv2 = regional, no cross-region
  • Not shared across non-clustered replicas
  • RTF: Persistence Gateway on Postgres
05 · ZERO-DOWNTIME 🔄

Rolling, blue-green, canary

Rolling updates are the production default. Blue-green gives instant rollback; canary ramps traffic. Both implemented at the router.

  • Rolling keeps old version live
  • Recreate = brief outage, faster
  • Canary via proxy weighted routing
  • Pair API Manager with NGINX/Flagger
06 · DR & MONITORING 📊

Single-region SLA, your multi-region

99.95% within a region; multi-region DR is your design. Anypoint Monitoring is on by default — alert on errors, P95, memory, restarts.

  • No multi-region HA out of the box
  • Global LB + cross-region DB replication
  • Thread/heap dumps per replica
  • Einstein diagnostics cut MTTR
Get the source code

The companion repo carries the complete deployment scaffold from this chapter — the cloudHub2Deployment pom.xml, a clustering-enabled variant, a Runtime Fabric values.yaml, the Anypoint MQ reliability flow, and the multi-region DR topology with Route 53 and Aurora Global Database. Clone it, set your secrets, and you have a resilient deployment blueprint to adapt.

github.com/nestaconnect/mulesoft-from-zero-to-hero
Up next · Chapter 09

DataWeave 2.0 Mastery — Advanced Transformations, Custom Modules & Performance Optimization

Continue reading →