Spotlight

Case Study Microsoft

How Microsoft scaled global content delivery

Find out how Microsoft used Gcore to strengthen delivery across regions.

case study ProSieben GNTM app TOPSHOT

How ProSieben scaled GNTM's app TOPSHOT

Explore how ProSieben brought real-time AI portraits to GNTM's audience.

case study Higgsfield

How Higgsfield scaled AI video generation

See how Gcore helped Higgsfield scale with GPUs and Managed Kubernetes.

case study Fawkes Games

How Fawkes Games stopped DDoS attacks

See how Gcore protected gaming servers from massive DDoS threats without disrupting gameplay.

We're hiring

Help build the next chapter of the web

We're not just filling seats. We're building a team that will write the next chapter of the internet.

  1. Home
  2. Learning
  3. Smart Upstream Switching at the Edge

Smart Upstream Switching at the Edge

  • By Gcore
  • August 28, 2026
  • 2 min read
Diagram illustrating an edge router securely connecting multiple users to various backend cloud services.

One of the most powerful features of edge computing is the ability to inspect and route traffic before it ever reaches your origin server. FastEdge gives you full programmatic control over request routing at every edge location worldwide.

In this post, we explore Smart Upstream Switching at the Edge — a core pattern for directing traffic intelligently across the global edge network. Instead of configuring complex reverse proxy rules or maintaining separate routing services, you write Rust code that compiles to WebAssembly and runs at every FastEdge point of presence.

How It Works

Route requests to different upstreams based on request properties, time of day, or A/B test buckets.

The key advantage is latency: routing decisions happen at the edge location closest to the user, not at a centralized load balancer or origin server. For a user in Tokyo, the routing decision happens at a Tokyo PoP — the response never crosses an ocean unless it needs to.

Implementation in Rust

The FastEdge Rust SDK provides everything you need. Here is a complete routing implementation:

 

This pattern — matching on the request URI in a simple match block — compiles to efficient WebAssembly with no external dependencies. For more complex routing needs such as path parameters and wildcards, consider the matchit crate, which implements a radix-tree router.

Deploying to Production

Once you've written your handler, build it and deploy via the FastEdge API:

 

Upload the resulting .wasm binary and attach it to your FastEdge HTTP application. The new routing logic is live across 100+ edge PoPs within seconds.

 Tip: Combine routing with other edge patterns — validate JWT tokens on protected routes, add GeoIP-based redirects for international users, and cache responses all within the same worker.

Performance Characteristics

FastEdge workers cold-start in under a millisecond. A simple match-based router adds less than 1µs to request processing time. Even with complex route tables of 50+ routes, the match overhead remains negligible compared to network latency — typically under 5µs.

Related articles

A glowing orange diagram illustrates data flow from client to edge, then to live processing, emphasizing security.
Running an MCP Server at the Edge

The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context and tools to LLMs. Think of it as a USB-C for AI — a universal interface that lets any LLM client communicate with any tool server witho

Diagram comparing Matchit and Regex for processing web requests, showing Matchit as faster and more efficient.
Routing with Matchit vs RegEx

Choosing the right routing strategy can make a significant difference in your FastEdge application's performance. This guide benchmarks three approaches on WASM.Approach 1: matchitmatchit is a Rust route-recognition library that uses a radi

Diagram showing a centralized KV data store connected to a web browser and global data centers.
Working with Edge KV Storage

This post covers Working with Edge KV Storage — a foundational pattern for stateful edge applications.How It WorksStore and retrieve key-value data at the edge. Perfect for config, feature flags, and session data distributed globally.Edge K

Network diagram illustrating secure data flow from client to edge and live processing.
WebSocket Proxying at the Edge

FastEdge workers aren't limited to just responding to incoming requests — they can also make outbound network requests to external services. This opens up a world of possibilities: aggregating data from multiple APIs, proxying requests to u

Diagram showing edge code securely accessing a secrets vault with authorized access control.
Using Environment Variables and Secrets

Security at the edge means threats are stopped before they reach your infrastructure. By implementing security logic in FastEdge workers, you can validate, filter, and block requests at the closest edge location to the user — providing the

Orange diagram shows data uploading, edge security, and S3 cloud storage.
Upload Files to S3 from the Edge

FastEdge provides distributed edge KV storage that lets you read and write data from any edge location worldwide. Unlike traditional centralized databases, edge KV stores data close to users — reads are served from the nearest PoP, making t

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.