×
Community Blog Friday Blog - Week 29 - Understanding Network Traffic Costs - Part 1

Friday Blog - Week 29 - Understanding Network Traffic Costs - Part 1

Wondering how to understand your network costs? Wonder no more! In Part 1 of our Network Cost series, we will de-mystify egress traffic costs on Alibaba Cloud.

Jeremy Pedersen

Understanding Network Traffic Costs: Part 1

Unsurprisingly, one of the more complicated aspects of cloud expenses is network traffic costs.

Calculating your storage and compute costs is usually straightforward: there are fixed fees for storage (in GB), memory (in GB), and CPU (per core).

Networking is not so simple. You can pay by bandwidth or by traffic, the source and destination of the traffic matters, and prices vary by cloud product.

In this week's post, the first of a multipart series, we take a look at how network pricing works for Alibaba Cloud Server Load Balancers (SLBs).

Future posts will discuss pricing for:

  1. Elastic IP (EIP)
  2. ECS public IP
  3. NAT Gateway
  4. Object Storage Service (OSS)

There are also products like MaxCompute that charge their own network traffic fees. We may talk about those in future posts, if there is demand.

First, Let's Talk About The Free Stuff

It's not all bad news and big bills! There are several classes of traffic that are actually zero-cost, including:

  1. Traffic between ECS instances in the same Zone
  2. Traffic between ECS instances in different Zones but the same Region
  3. Traffic to/from private Server Load Balancers (within a single Region)
  4. Traffic to/from OSS over the internal network endpoint (within a single Region)

Which brings us to our first cost-saving tip!

Cost-saving tip: Keep traffic within Alibaba Cloud whenever possible, to avoid network egress charges

Ok, On To The Stuff That Costs Money

Just a quite note: unless otherwise indicated, prices are for Alibaba Cloud's Singapore Region. Prices vary from Region to Region. I have chosen Singapore because it is one of the more expensive regions, so you should actually end up paying less (with a few exceptions) if you choose another region.

Server Load Balancer (SLB) Egress Charges

There are two types of Load Balancer on Alibaba Cloud:

  1. The "Classic Load Balancer" (CLB)
  2. The "Application Load Balancer" (ALB)

CLBs are designed for Layer 4 (TCP/UDP) and Layer 7 (HTTP/HTTPS), while ALB is a newer type of Load Balancer that only handles Layer 7 (HTTP/HTTPS) but with lots of additional routing features and better scalability. Let's focus on CLB first.

Classic Load Balancer (CLB)

Internet-facing CLBs have two payment "modes" for egress traffic:

  1. Pay-by-bandwidth (up-front)
  2. Pay-by-traffic (pay-as-you-go)

Pay-by-bandwidth

Pay-by-bandwidth charges you up-front for a fixed amount of bandwidth (measured in megabits per second - Mbps). For Singapore, the prices are:

  1. 0.006 USD / hour (1-5 Mbps)
  2. 0.02 USD / hour (> 5 Mbps)

This doesn't actually mean that your egress traffic can be arbitrarily high: it is limited by your CLB specification, and bigger CLBs cost more. I don't cover those other fees in this blog post because they aren't network related, but you can find them here.

Also, something that is often confusing for new users: this cost is per-Mbps. So the 0.006 USD above is for 1 Mbps worth of traffic! 2 Mbps would cost 0.012 USD, 3 Mbps would cost 0.018 USD, and so on...

Here's a table to help make the costs clearer:

pay_by_bandwidth

The two middle columns show the amount of traffic (in Mbps) charged at 0.006 USD vs the amount charged at 0.02 USD.

The cost does scale with bandwidth, but relatively slowly.

Pay-by-traffic

Pay-by-traffic is "Pay-As-You-Go", meaning you are charged based on the actual amount of outbound traffic (measured in GB).

CLB charges a data transfer fee when you are using the pay-by-traffic payment mode. For Singapore, that fee is 0.117 USD / GB.

Again, the upper limit on how much traffic your Load Balancer can actually handle depends on its type (also called a specification), so there is a hard upper limit on SLB bandwidth. Bigger SLB instances have a higher threshold.

With Pay-by-traffic, you'll pay for exactly the amount of egress traffic you generated, in GB.

Application Load Balancer (ALB)

Application Load Balancers connect to the Internet using Elastic IPs. We will cover EIPs in a future blog post, so I'm going to skip over ALB for now!

How To Choose The Right Payment Method

Graph It Out

Let's do an (admittedly unfair) comparison between Pay-by-traffic and Pay-by-bandwidth, just to help us understand the math:

slb_egress

slb_cost_graph

You can see pretty clearly that costs scale much more reasonably for Pay-by-bandwidth, as long as we have constant egress traffic.

What would happen if we switched to a model where we have to handle 50 Mbps, but it only happens once an hour for 2 minutes? Of course, Pay-by-traffic wins in that scenario. Why? Let's do the math:

  1. Using Pay-by-bandwidth, we'd have to pay for the whole 50 Mbps, every hour, every day. Over a 24 hour period, that would be 24 hours x 0.93 USD /hour = 22.32 USD
  2. Using Pay-by-traffic, we're paying for 50 Mbps of traffic for two minutes each hour: 50 Mbps / 8 Mbit/MB * 2 minutes * 60 seconds / minute = 750 MB. That's our total traffic each hour. Over 24 hours that's 18,000 MB or about 17.58 GB. The total Pay-by-traffic cost is therefore 17.58 x 0.117 = 2.06 USD.

The TL;DR here is: Pay-by-bandwidth is good for both low and high bandwidth applications, as long as your average utilization is high. Pay-by-traffic only makes sense for bursty workloads that are also low traffic over the long term.

Let's do the math ourselves for a few more scenarios, just to cement what we've learned so far.

Scenario 1: Steady Traffic

Your CLB is generating 4 Mbps of traffic 24 hours a day, every day.

Using the pricing model above, your cost over 10 days would be:

4 Mbps * 0.006 USD / hour * 24 hours/day * 10 days = 5.76 USD

Again, assuming 4 Mbps, 24 hours a day, if you used Pay-by-traffic in this scenario, it would cost:

4 Mbps / 8 Mbits/MB * 3600 seconds/hour * 24 hours * 10 days = 432,000 MB

432,000 MB / 1024 MB/GB * 0.117 USD / GB = 49.36 USD

So we can see that Pay-by-bandwidth is significantly cheaper here.

Scenario 2: Unpredictable Traffic

Let's re-do our math, except that now we will make different assumptions about our traffic.

Over a 10 day period, our traffic is essentially 0 Mbps most of the time, with two 10 Mbps "spikes", each lasting 2 hours (for a total of 4 hours at 10 Mbps, over our 10 day period).

Using Pay-by-traffic, our 10-day cost comes out to:

10 Mbps / 8 Mbits/MB * 3600 seconds/hour * 2 hours * 2 days with traffic = 18,000 MB

18,000 MB / 1024 MB/GB * 0.117 USD / GB = 2.06 USD

Using Pay-by-bandwidth, our cost for 10 days is:

(5 x 0.006 + 5 x 0.02) * 24 hours/day * 10 days = 31.20 USD

Here we see that Pay-by-traffic is cheaper in this scenario.

That's it for this week! See you next Friday. ^_^

I've Got A Question!

Great! Reach out to me at jierui.pjr@alibabacloud.com and I'll do my best to answer in a future Friday Q&A blog.

You can also follow the Alibaba Cloud Academy LinkedIn Page. We'll re-post these blogs there each Friday.

Not a LinkedIn person? We're also on Twitter and YouTube.

0 1 0
Share on

JDP

71 posts | 157 followers

You may also like

Comments