Subject: [rtcweb] Audio transcoding: CPU costs

From: Harald Alvestrand <[email-masked]>
Date: Thu, 14 Mar 2013 01:01:01 +0100

To return to the question of "cost of transcoding":

- AMR is less complex to en/decode than OPUS. So the dominant cost of 
transcoding between OPUS and AMR is the OPUS operation.
- http://www.ietf.org/mail-archive/web/rtcweb/current/msg05236.html 
estimates that OPUS en/decode can be done at ~1000 channels per CPU.
- One machine for one minute on Amazon AWS costs 0.24 cents for a 
medium-sized "high-CPU instance" according to 
http://aws.amazon.com/ec2/pricing/ (0.145 dollars per hour).
- Accordingly, transcoding, if done on fully loaded Amazon AWS 
instances, adds ~0.00024 cents per minute to the cost of a call.

There are other ways to provide such a service. It seems unlikely to 
increase the CPU cost of the call by more than a factor of 100, so we're 
still below 0.024 cents per hour.

I know there are other arguments for avoiding transcoding. But calling 
the CPU cost "negligible" seems appropriate in a world where mobile 
non-"all you can eat" plans still sell for tens of cents per minute.

---

From: Roman Shpount <[email-masked]>
Date: Thu, 14 Mar 2013 01:03:19 -0400

Though I generally agree with results of your analysis (CPU cost per minute
of transcoding is small), i would like to point out a few things regarding
this analysis:

1. Based on the message you are quoting, current performance is 150
channels per core. It would require some non-trivial work to get it to 500
channels.
2. Transcoding server would definitely need to purchase AMR/AMR-WB licenses.
3. Transcoding would require jitter buffer and other code which would not
be needed for ICE/SRTP gateway
4. Amazon AWS are not really usable for transcoding or any other real-time
specific operations. You end up with too much jitter when processing media
introduced by a virtualized instance.

Based on my benchmarks and my napkin based estimate ($4000 per
server amortized over 3 years, $300 per server per month to host it, 1000
channels of transcoding per server), the cost of one channel of transcoding
is about $0.4 per month vs about $0.02 per month for ICE/SRTP only gateway
(if transcoding is not needed, server can do 20,000 channels). This does
not take into account management and operation costs which grow
proportionally since you end up needing 20 times as much hardware. It also
does not include costs of software licenses. Depending on how spiky your
traffic is this can translate into different price per minute, but based on
our conference service we do about 12,000 minutes per channel per month
this translates into 0.003 cents per minute, which is not far from your
estimate.

Regards,
_____________
Roman Shpount

On Wed, Mar 13, 2013 at 8:01 PM, Harald Alvestrand <[email-masked]>wrote:

> - http://www.ietf.org/mail-archive/web/rtcweb/current/msg05236.htmlestimates that OPUS en/decode can be done at ~1000 channels per CPU.
> - Accordingly, transcoding, if done on fully loaded Amazon AWS instances,
> adds ~0.00024 cents per minute to the cost of a call.
>
> I know there are other arguments for avoiding transcoding. But calling the
> CPU cost "negligible" seems appropriate in a world where mobile non-"all
> you can eat" plans still sell for tens of cents per minute.
>
>
> _______________________________________________
> rtcweb mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/rtcweb
>
>

---

From: Jean-Marc Valin <[email-masked]>
Date: Thu, 14 Mar 2013 01:32:23 -0400

On 03/14/2013 01:03 AM, Roman Shpount wrote:
> 1. Based on the message you are quoting, current performance is
> 150 channels per core. It would require some non-trivial work to
> get it to 500 channels.

Yeah, it'd probably take 2-3 weeks to write some assembly. Also, keep
in mind that these numbers were measured using a single core of a
laptop that just turned three years old
(http://ark.intel.com/products/43560/Intel-Core-i7-620M-Processor-4M-Cache-2_66-GHz).
I would expect your servers to have slightly more powerful CPUs :-)

	Jean-Marc

---

From: "Espen Berger (espeberg)" <[email-masked]>
Date: Thu, 14 Mar 2013 21:29:12 +0000

Transcoding is not the only cost when mapping from one audio codec to another one in some infrastructure component. 

* You need to re-encrypt to get secure calls
* Map between resilience techniques from different codecs  
* Rate adaptation from one bitrate to another 

-Espen 

-----Original Message-----
From: [email-masked] [mailto:[email-masked]] On Behalf Of Jean-Marc Valin
Sent: 14. mars 2013 06:32
To: Roman Shpount
Cc: [email-masked]
Subject: Re: [rtcweb] Audio transcoding: CPU costs

On 03/14/2013 01:03 AM, Roman Shpount wrote:
> 150 channels per core. It would require some non-trivial work to get 
> it to 500 channels.

Yeah, it'd probably take 2-3 weeks to write some assembly. Also, keep in mind that these numbers were measured using a single core of a laptop that just turned three years old (http://ark.intel.com/products/43560/Intel-Core-i7-620M-Processor-4M-Cache-2_66-GHz).
I would expect your servers to have slightly more powerful CPUs :-)

	Jean-Marc

---

From: Harald Alvestrand <[email-masked]>
Date: Fri, 15 Mar 2013 18:36:54 +0100

On 03/14/2013 06:03 AM, Roman Shpount wrote:
> Though I generally agree with results of your analysis (CPU cost per 
> minute of transcoding is small), i would like to point out a few 
> things regarding this analysis:
>
> channels per core. It would require some non-trivial work to get it to 
> 500 channels.

That was 150 channels for one CPU of an old laptop. I don't know how 
many cores Amazon's servers have, but I picked the "CPU-heavy" variant 
for that reason.

> 2. Transcoding server would definitely need to purchase AMR/AMR-WB 
I'm glad you brought that up :-)
The nice thing about this way of doing it is that all the licensing cost 
falls on the users of that service, and no licensing costs are incurred 
by anyone who doesn't want to use this particular service - unlike 
solutions that are shippped by default to users whether they use it or not.

> 3. Transcoding would require jitter buffer and other code which would 
> not be needed for ICE/SRTP gateway

Yep. As I said, there are other things than cost to consider - I wanted 
to focus on this particular item in this thread.

> 4. Amazon AWS are not really usable for transcoding or any other 
> real-time specific operations. You end up with too much jitter when 
> processing media introduced by a virtualized instance.

> server amortized over 3 years, $300 per server per month to host it, 
> 1000 channels of transcoding per server), the cost of one channel of 
> transcoding is about $0.4 per month vs about $0.02 per month for 
> ICE/SRTP only gateway (if transcoding is not needed, server can do 
> 20,000 channels).

Yep. I used their price as "this is a reasonable approximation for what 
it costs to operate a server at bulk rates". Your estimates seem to land 
in the same ballpark, so it wasn't entirely off into left field. 40 
cents per month is 0.00093 cents per minute (ignoring the need to have 
idle capacity).

> This does not take into account management and operation costs which 
> grow proportionally since you end up needing 20 times as much 
> hardware. It also does not include costs of software licenses. 
> Depending on how spiky your traffic is this can translate into 
> different price per minute, but based on our conference service we do 
> about 12,000 minutes per channel per month this translates into 0.003 
> cents per minute, which is not far from your estimate.

At least we've agreed that the cost of transcoding audio is not 
significant. Nice to agree on something!