[英]REST API and CDN for audio streaming
I'm facing a bandwith issue on a server that hosts a REST API and I wondered if I could use a CDN to fix it.我在托管 REST API 的服务器上遇到带宽问题,我想知道是否可以使用 CDN 来修复它。
Most of the bandwith consumption is due to static assets provision, like audio files.大部分带宽消耗是由于 static 资产提供,如音频文件。
Access to those assets requires an authentication token (JWT like).访问这些资产需要一个身份验证令牌(类似 JWT)。 When the user requests for an asset, I first need the API to do some checkups, and then streams an audio file.
当用户请求资产时,我首先需要 API 进行一些检查,然后流式传输音频文件。
A CDN appeared to me as an ideal solution, but it raised two questions: CDN 在我看来是一个理想的解决方案,但它提出了两个问题:
Thanks for your time and advices感谢您的时间和建议
If you want basic API authentication for CDN request then most CDN's support mechanism to do this - for example the Akamai information is here:如果您想要对 CDN 请求进行基本 API 身份验证,那么大多数 CDN 的支持机制都可以做到这一点 - 例如 Akamai 信息在这里:
Answering the second question, so long as the CDN and your client support range requests then you should be able to download chunks, if you are using basic HTTP progressive download type streaming.回答第二个问题,只要 CDN 和您的客户端支持范围请求,那么您应该能够下载块,如果您使用基本的 HTTP 渐进式下载类型流。
If you are using HLS or DASH streaming then nearly all CDN's will support this as standard.如果您使用 HLS 或 DASH 流媒体,那么几乎所有 CDN 都会将其作为标准支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.