Global anycast in a click: How Magic Containers simplifies low-level global networking

Posted by:

With the popularity of CDNs and managed cloud services, running HTTP-based applications has become relatively simple. Simple enough that it’s become very easy to forget the level of complexity actually involved under the hood to make global networking work.

However, for service providers, managing these low-level network systems remains a complex challenge. Take anycast, for example; it’s expensive, wasteful, and time-consuming to set up. To get started, you need to acquire very expensive, dedicated IP space with at least 256 IPs as a minimum, even if just to provision a single application. And that only gets you started. Maintaining anycast day-to-day with an optimized global configuration can feel like a full-time job.

At bunny.net, we run one of the most extensive network infrastructures in the world, which also consists of multiple anycast systems. This gives us extensive firsthand experience with the challenges and headaches of maintaining anycast configurations.

One of our goals when finding new products to build is to take these very complex global challenges and simplify them into just a few clicks in the dashboard—and that’s exactly what we did with Magic Containers and anycast.

In this post, we'll explore what anycast is, why it's so challenging to build and maintain, and how Magic Containers has made deploying anycast as simple as pressing a button.

What even is anycast?

Imagine you’re craving some caffeine. You open your map and type in “coffee.” The map doesn’t send you to a random shop across town. Instead, it directs you to the nearest cafe, right next to you.

That’s anycast in a nutshell: multiple servers sharing the same IP address, with the network automatically routing traffic to the closest possible one.

In contrast, traditional (unicast) IPs are more specific. They are more like choosing a specific cafe on the map, and getting specific instructions to get to that exact one, even if there’s a perfectly good cafe around the corner.

In networking terms, this means each server has its own unique IP that provides the specific path to reach that exact server, compared to a series of servers all sharing the same IP and the network route connecting you to whichever is closest.



This makes anycast perfect for low-level, globally distributed networks that need ultra-low latency, exceptional resiliency, and network-level global load balancing that can’t rely on HTTP, DNS, or other ways of load balancing in a distributed environment.

These characteristics make anycast networks an essential part of some of the most complex and critical systems powering the internet today, including most of the world’s CDN and DNS services in one way or another.

To learn more about anycast, you can check out our Bunny Academy Anycast Article for a deep dive.

Why anycast is a nightmare to build and maintain

With great power comes great responsibility, and with anycast, even greater complexity. For those already familiar with building and maintaining an anycast network, you have our condolences. For everyone else, here’s what makes running them so challenging.

The first hurdle starts with the cost. It takes up to tens of thousands of dollars just to get started purchasing a /24 IP subnet. No matter if you need a single one, you still need to buy the whole range to announce. Along comes a ton of paperwork, configuration, and slow turnaround times. If you can stomach the cost, you then need to register an ASN, find suitable compute or network partners, spend weeks setting it all up, and then spend even more time optimizing and tweaking the BGP network configuration.

Once you’re done, you’re not actually done. The maintenance never stops, and you need to continually monitor, tweak, and optimize the setup or you might quickly end up with your network traffic no longer taking the shortest route and instead making world trips around the globe. Because anycast routes are not based on geographical distance but on the number of network hops, each location needs careful tweaking, such as prepending hop counts or blacklisting specific paths to make sure that users are not connecting across the ocean instead. And this is simplifying it. To make matters worse, the more regions you add, the more complex it all gets.

The high entry cost and high complexity of maintenance make anycast networks prohibitively expensive and too difficult for most small organizations. For those that can actually pull it off, it then becomes a constant challenge to keep it optimized.

Even large organizations with dedicated network teams face constant ongoing challenges with optimizing, monitoring, and maintaining their anycast infrastructure. In fact, many catastrophic global CDN outages have occurred due to one simple faulty BGP community setting.

At bunny.net, we said: Not anymore!

Making anycast magical: Deploying anycast DNS in less than 5 minutes

At bunny.net, we know these challenges perhaps too well, and we decided to make sure you don’t have to. We built Magic Containers with the goal of making cloud and edge computing feel like magic, and we’re doing the same for anycast.

With Magic Containers, the technical challenges are a thing of the past. Deploying a global anycast application is now as simple as selecting a Docker image and configuring an anycast endpoint with a few clicks. Your application is then automatically provisioned either fully globally, in a single region, or automatically distributed based on real-time AI traffic analysis, making sure it’s running only where needed, when needed for the best possible performance.

And it’s not just any anycast network. With Magic Containers, you get immediate access to up to 36+ anycast-enabled regions around the world, running on our premium edge network that sits less than 40 ms away from most of the world’s population and powers one of the fastest CDNs in the world. Best of all, without writing a single line of BGP configuration.

To demonstrate how easy we’ve made it to deploy a global anycast service, we’ve built a simple demo DNS server image (source code) that always responds to every query with a dynamic TXT record. Deploying it takes just a few simple steps:

  1. First, we name our application. Let’s call it “DNS Demo App.”
  1. To push this globally, we will then choose a deployment with Custom Settings and select all regions as Base Regions. This will disable dynamic provisioning and automatically deploy the service everywhere around the world.
  1. Next, we will add a container and select our demo image. Magic Containers will automatically suggest an endpoint, so we can just click Add Container. Optimally, we could also configure the monitoring settings to only send traffic to each instance once it’s fully up and running, but won't for this example.
  1. On the confirmation screen, we get an overview. Just click Confirm and Create, which will start provisioning the app.
  1. And we’re done. A few seconds later, Magic Containers starts provisioning our anycast-powered DNS server globally.

That’s it. In less than a minute, our DNS cluster is now provisioned globally and our global network automatically routes all traffic to the closest possible one. We can give it a try using dig:

/* Testing from Bangkok */
dig @109.224.228.83 +short   
"Hello from Magic Containers region SG!"

/* Testing from Frankfurt */
dig @109.224.228.83 +short   
"Hello from Magic Containers region DE!"

/* Testing from New York */
dig @109.224.228.83 +short   
"Hello from Magic Containers region NY!"

It's now really that simple to get started with global anycast. No more high upfront cost, or complex configuration; just a few simple clicks in the dashboard. All the complex networking, BGP optimizations, and global configuration are handled automatically for you in the background, letting you focus on building amazing applications.

How does this work under the hood?

To the end user, we made the process feel like magic. Under the hood, however, a lot of complex network logic is taking place. To make this all seamlessly work together, we utilized our massive global edge network that powers Bunny CDN. We then connected all the regions to each other through a series of dynamic tunnels, allowing Magic Containers to have an ultra-fast edge entry point right next to your users. Those tunnels are then used to forward that traffic only to the regions where your application is actually running, whether it's one region or 36+ around the world.

Our infrastructure team continually monitors, optimizes, and maintains this network to make sure it’s running at peak performance at all times, and you don’t have a single worry in the world about how it all runs behind the scenes.

If using the AI-optimized deployments, we also monitor your traffic in real-time straight at the edge, and feed that to the Magic Containers to automatically provision your application only in the regions that will provide the best possible latency, for the lowest possible costs.

Then, you can take that a level further by adding Health Monitoring to the mix, ensuring that traffic is only routed there once the application is actually ready to serve requests and in a healthy state. Essentially, this makes it extremely easy to deploy highly available global services that dynamically scale with your workloads.

If one of the regions goes offline, traffic is also automatically, and instantly re-routed to the next possible one, ensuring unparalleled performance and reliability.

Affordable for everyone: Deploy anycast for less than the price of a coffee

And the most magical thing of all—we've made anycast networking accessible to just about anyone with a flat fee of only $2 per month for a global anycast IP address. Less than a cup of coffee. This, combined with Magic Containers’ pay-as-you-go compute pricing, means you can get started for just a few dollars per month and only scale once you actually get traffic.

Here’s the magic formula:

  • CPU time: $0.02 per 3,600 CPU seconds
  • Memory: $0.005 per GB/hour (billed in 64 MB chunks)
  • NVMe Storage: $0.10 per GB/month
  • Network traffic: $0.01 per GB

Instead of wrestling with high costs and complexity, Magic Containers makes anycast as straightforward as deploying any other application. Effortless. Affordable. Magical.

Ready to add a sprinkle of magic to your global anycast deployments?

If you’re struggling with the complexities or high cost of anycast networks, or never even got your project off the ground, we’re thrilled to offer you a much better option.

With the launch of Magic Containers, global anycast networks become set-and-forget, and we do the heavy lifting for you. Our team is consistently monitoring and optimizing our network to achieve maximum performance and reliability, giving you the time and money back to focus on what you do best: building great software or providing great services.

Magic Containers is now available to anyone. Give it a try and deploy your first anycast application in just a few clicks.

Want to help us build a faster internet?

At bunny.net, we’re on a mission to help make the internet hop faster, and part of that is solving big internet challenges and making them as simple as a few clicks. If you’re passionate about performance and networking and would like to help build and power the next generation of applications, make sure to check out our Careers Page.