LogoLogo
Visit Contextual.ioSign Up
  • Getting Started
    • Welcome
    • Tour: Hello, AI World!
  • TRAINING
    • Basic Developer Training Course
      • Lesson 1: HTTP Agent Introduction
      • Lesson 2: Logging and Error Handling Basics
      • Lesson 3: Event Processing Agent Introduction
  • Services Catalog
    • What's in the Catalog?
      • Intro Patterns
      • Object Type Bundles
    • Browse by Platform
    • All Intro Patterns
      • Anthropic Claude Image Analysis
      • Mistral AI Prompt and Response
      • xAI Grok Prompt and Response
      • DeepSeek Chat Prompt and Response
      • Qwen Chat Prompt and Response
      • Perplexity AI Search and Response
      • Firecrawl Website Scraper
      • Groq Prompt and Response
      • Nyckel Dog Breed Classification
      • RapidAPI ClassifyAI Text Classification
      • RapidAPI YouTube AI Video Summary
      • UnifyAI Model Comparison
      • WebPilot URL Analysis and Summarization
      • OpenAI Assistants Prompt and Response
      • OpenAI Sync
    • All Prebuilt Solutions
      • Invoice AI
      • Lead Generation Form
    • All Object Type Bundles
      • Work Order Management System ITIL Object Type Bundle
        • Work Order
        • User
        • Role
        • Permission
        • Asset
        • Task
        • Action
        • Attachment
        • Comment
        • Notification
        • Audit Log
        • Service Level Agreement
        • Custom Fields
        • Work Order Template
        • Work Order Transition
        • Escalation Policy
        • Tag
  • Components & Data
    • Object Types
      • Data in Contextual
        • Secrets
        • Validation
        • Versioning
      • Examples
      • Creating an Object Type
      • Object Type Details
        • Definition
        • Data Schema
          • Automatic Record Metadata
          • Generated Values
            • Dates and Times
            • UUIDs
          • Frequently Used Validation
          • Disallowing Null Property Values
          • Disallowing Undefined Properties
          • Secrets
          • AI Assistant
          • ID and PrimaryKey Permanence
        • UI Schemas
        • Features
        • Triggers
        • Actions
        • Audit Trail
        • Versions
        • Templates
        • Records
      • Using Object Types in Flows
      • Records
        • Records and Your Tenant API
        • Record Import
    • Flows
      • Nodes
      • Wires
      • Message Object
      • Flow Editor
        • Basics
        • Saving Changes
        • In-Flow Testing with Debugger
        • Restart Agents to Make Changes Active
        • Config
      • Node Reference
        • Common
          • Log Tap
          • Inject
          • Debug
          • Complete
          • Catch
          • Status
          • Link In
          • Link Call
          • Link Out
          • Comment
        • Event
          • Prepare Event
          • Event Start
          • Event End
          • Event Error
        • Object
          • Search Object
          • Get Object
          • Create Object
          • Patch Object
          • Put Object
          • Delete Object
          • Run Action
        • Request
          • Send to Agent
          • HTTP GET
          • HTTP PATCH
          • HTTP PUT
          • HTTP DELETE
          • HTTP POST
          • GQL
          • Produce Message
        • Function
          • Function
          • Switch
          • Change
          • Range
          • Template
          • Delay
          • Trigger
          • Exec
          • Filter
          • Loop
        • Models
          • ML Predict
        • Network
          • MQTT In
          • MQTT Out
          • HTTP In
          • HTTP Response
          • HTTP Request
          • WebSocket In
          • WebSocket Out
          • TCP In
          • TCP Out
          • TCP Request
          • UDP In
          • UDP Out
        • Sequence
          • Split
          • Join
          • Sort
          • Batch
        • Parser
          • csv
          • html
          • json
          • xml
          • yaml
    • Agents
      • Creating an Agent
      • Types of Agents
        • Event to Flow
        • HTTP to Flow
          • Custom Domains
      • How Agents Work
        • Flow Execution
        • HTTP Load Balancing
        • Event Routing
      • Scale and Performance
        • Flow execution
        • Parallel Instances
        • Event Lag Scaling
        • Compute Threshold Scaling
        • Instance Compute Sizing
      • Agent Details
        • Definition
        • Operations
        • Logs
          • Session Log
          • Message Log
        • Audit Trail
        • Versions
      • Using Agents in Flows
    • Connections
      • Creating a Connection
      • Types of Connections
        • Basic
        • Bearer
        • Client Grant
        • Kafka
        • Password Grant
        • Public
        • Pulsar
      • Using Connections in Flows
    • JWKS Profiles
      • Using JWKS Profiles in Your Solution
  • PATTERNS
    • Solution Architecture
      • Events, Messages, Queues
    • Working with Data
      • Search Object Node & Pagination
      • Message Payload Content - Triggers and Actions
    • Industry Cookbooks
      • Field Services
  • Tenants
    • Tenant Workspace
    • Tenant Logs
      • Contextual Log Query Language (CLQL)
        • String Searches
        • Keyword Searches
        • Advanced Operators
    • Tenant API
      • API Keys
        • API Key Settings
        • API Key Permissions
      • Documentation
  • Release Notes
    • 2024
      • 2024.12.09
Powered by GitBook
On this page

Was this helpful?

  1. Components & Data
  2. Agents
  3. How Agents Work

HTTP Load Balancing

Overview

Load balancing in Contextual involves distributing incoming network traffic across multiple Agent instances. This ensures that no single instance is overwhelmed, improving the application's availability, fault tolerance, and scalability.

Key Concepts

  1. Instances: The smallest deployable units in Contextual, each running an Agent. Instances handle individual parts of the workload.

  2. Deployments: Contextual objects that manage the lifecycle of instances, including scaling up and down, updating, and rolling back instances.

  3. Services: Contextual abstractions that define a logical set of instances and a policy by which to access them. Services provide load balancing across the instances.

  4. Ingress Controllers: Components that manage external access to the services in a Contextual environment, typically providing HTTP and HTTPS routing.

How It Works

  1. Deployment Management:

    • Replicas: A Contextual Deployment ensures that a specified number of Agent instances are running at any given time. If an instance fails, Contextual will automatically replace it.

    • Rolling Updates: The Deployment can perform rolling updates, ensuring that Agent instances are updated with zero downtime.

  2. Service Discovery and Load Balancing:

    • Service Definition: A Contextual Service is created to expose the Agent instances. This service has a stable IP address and DNS name, allowing other services or external users to connect to Agents without needing to know the IP addresses of individual instances.

    • Load Balancing: The Service automatically balances HTTP requests across the available Agent instances. When a request comes in, it is distributed to one of the instances based on the service's load balancing policy, typically round-robin or random.

  3. Ingress Management:

    • Ingress Controller: An Ingress Controller is deployed in the Contextual environment to manage external access. The Ingress Controller routes external HTTP and HTTPS traffic to the appropriate services based on defined rules.

    • Ingress Resource: An Ingress Resource is configured to define how incoming requests should be routed to the Agent Service. This allows for more advanced routing rules, SSL termination, and load balancing for HTTP traffic.

Example Flow

  1. Client Request:

    • A client sends an HTTP request to the Agent application.

  2. Ingress Controller:

    • The request hits the Ingress Controller, which examines the Ingress Resource to determine the correct Service to forward the request to.

  3. Service Load Balancing:

    • The Service receives the request and forwards it to one of the Agent instances, distributing traffic evenly based on the configured load balancing policy.

  4. Agent Instance:

    • The selected Agent instance processes the request and sends the response back to the client.

Benefits

  • Scalability: Contextual can scale the number of Agent instances up or down based on traffic load, ensuring optimal resource usage.

  • High Availability: By distributing traffic across multiple instances, Contextual ensures that the failure of a single Agent instance does not bring down the entire service.

  • Resilience: Contextual automatically handles instance failures and restarts, maintaining the desired number of Agent instances running at all times.

Summary

Load balancing across multiple Agents in Contextual involves using Deployments to manage the lifecycle of Agent instances, Services to provide load-balanced access to these instances, and Ingress Controllers to manage external HTTP traffic. This architecture ensures that traffic is evenly distributed, improves fault tolerance, and allows the system to scale dynamically based on load.

PreviousFlow ExecutionNextEvent Routing

Last updated 9 months ago

Was this helpful?