Skip to main content

Overview

Iqra AI’s multi-region architecture allows you to deploy geographically distributed infrastructure to minimize latency and improve reliability. The system routes sessions to the nearest compute node based on geographic proximity, enabling you to combat the physical limitations of network speed. This is particularly critical for real-time voice applications where every millisecond counts in the user experience.

Architecture

Region components

Each region in Iqra AI consists of three core components:
  1. Backend servers - Handle agent logic, conversation processing, and business rules
  2. Proxy servers - Manage WebRTC/SIP connections and media streaming
  3. S3 storage - Store recordings, logs, and media files
Regions are identified by a composite ID format: {CountryCode}-{RegionName} (e.g., US-EAST, EU-CENTRAL).
The region management system is located in IqraInfrastructure/Managers/Region/RegionManager.cs:66.

Regional isolation

Each region operates independently with its own:
  • Compute resources (Backend and Proxy nodes)
  • Storage infrastructure (S3-compatible object storage)
  • Maintenance and availability status
  • Configuration and API keys

Creating a region

1

Define region parameters

Choose a country code and region name that clearly identifies the geographic location.
2

Create the region

New regions are created in a safe, disabled state by default:
This creates region US-WEST with:
  • Disabled status (prevents accidental traffic routing)
  • Maintenance mode enabled
  • No active servers
3

Configure S3 storage

Each region requires its own S3-compatible storage:
4

Add compute servers

Deploy Backend and Proxy servers to handle traffic:
API keys must be at least 32 characters long. Generate cryptographically secure keys for production deployments.
5

Enable the region

Once all infrastructure is configured and tested:

Server management

Adding servers

Each region can contain multiple Backend and Proxy servers for horizontal scaling:

Server lifecycle

Servers support granular lifecycle management:
Control traffic routing to individual servers:
Put servers in maintenance mode without fully disabling them:
Servers can only be deleted when they meet strict safety criteria:
Deletion will fail if:
  • Server is not in disabled state
  • Server is still reporting online status
  • Server has active sessions

Region status management

Maintenance mode

Use maintenance mode for planned updates without fully disabling the region:
The publicReason is visible to end users, while privateReason is for internal operations teams. Use public reasons that are customer-friendly.

Disabling regions

Temporarily or permanently disable regions:

Best practices

Geographic distribution

1

Measure user distribution

Analyze where your users are located geographically. Deploy regions close to your largest user populations.
2

Start with critical regions

Begin with 1-2 regions in your primary markets before expanding globally.
3

Consider data residency

For enterprise deployments, ensure you have regions in countries with data residency requirements (e.g., GCC nations, EU).

Capacity planning

Plan server capacity based on expected concurrent sessions:
  • Backend servers: 50-100 concurrent calls per server (depending on hardware)
  • Proxy servers: 100-200 concurrent WebRTC connections per server
  • Storage: Estimate 1-5 MB per minute of recorded conversation

Failover strategy

  1. Deploy redundant servers in each region (minimum 2 Backend, 2 Proxy)
  2. Use health checks to detect failing nodes
  3. Configure automatic traffic rerouting when servers enter maintenance mode
  4. Maintain a secondary region for critical deployments

Security

Never reuse API keys across servers or regions. Each server must have a unique, cryptographically secure API key of at least 32 characters.
  • Rotate API keys quarterly
  • Use different S3 credentials for each region
  • Implement network isolation between regions
  • Restrict database access to internal networks only

Monitoring regions

Monitor regional health using the metrics system:
See Monitoring and observability for detailed metrics and alerting.

Deleting regions

Region deletion requires strict safety checks:
1

Disable all servers

Disable every server in the region and wait for active sessions to complete.
2

Disable the region

Put the region itself in disabled state:
3

Verify no active nodes

Ensure no servers are reporting status before deletion.
4

Delete safely

The deletion will fail with error DeleteRegion:NODES_ONLINE if any servers are still reporting status. This prevents accidental deletion of active infrastructure.

Next steps

Monitoring

Set up observability for your multi-region deployment

Scaling

Learn horizontal scaling strategies for high traffic