当前位置:网站首页>How to control CDN traffic gracefully in cloud development?
How to control CDN traffic gracefully in cloud development?
2022-06-24 04:39:00 【Tencent cloud development TCB】
In the community , There are a lot of feedback from small partners using cloud development “CDN Flow consumption is like running water ” The situation of .
One day I woke up :
Have been loaded with high quality pictures “ scared ” I dare not use it :
So here comes the question , How to manage gracefully in cloud development CDN Traffic consumption ? This article will talk with you in detail !
01、 Pay as you go and pay as you go
For the sake of understanding , Let's take a look at the traffic billing mode of cloud development first .
Simply speaking , Pay by volume Namely : How many of you ran out , I'll give you the quantity ; But it doesn't limit how much you can run out at the same time , That is, there is no limit to the peak flow .
If you need to run out at the same time 100M The amount of , Then I'll drive you to the peak 100M, Run at the same time , The final cost is 100M The money .
and Pipeline payment It's about limiting how wide it's going to be for you “ road ”, According to this “ road ” Wide and narrow charges of , For example, you choose 1M The road of the Internet , Then according to 1M I'm going to charge you at a reasonable price ; When use , Your quantity can only reach 1M The speed of , It can't be any higher , This maximum speed is called bandwidth .
But even when the low peak doesn't have much , You also have to work for this “ road ” pay . Or the above , You need to run out at the same time 100M, But the speed will only give you to 1M, So these quantities are 100 You can walk in seconds , The final cost is 1M The road rent of * The length of the lease .
And in real projects , There will always be peaks and lows in business , It's almost impossible to keep the flow at a constant rate all the time , This creates a ceiling with speed 、 But the waste of resources that are still charging when idle .
Cloud development as Serverless Cloud native integrated back end service , The traffic provided is paid by volume , Pipeline payment is not supported , Don't limit the flow rate at the same time , therefore , If developers use it unreasonably, it will lead to too fast flow , This will lead to rapid excess flow .
After understanding the difference between pay as you go and pay as you go , Let's get to the point , say something CDN.
02、 What is? CDN Traffic ?
When we use cloud development , You can see it almost everywhere CDN The word .
CDN also called Content distribution network , Generally speaking, it is to store your main memory ( Origin station ) Documents in , Copy to storage points everywhere (CDN node ), When a user accesses this resource , Directly from the nearest storage point (CDN node ) Get it .
Natural support for cloud storage and static website hosting of cloud development CDN Speed up , So the traffic that your users download files through the client is CDN Traffic .
above CDN Traffic is only applicable to all kinds of channels to speed up the downloading of files from the public network , For example, the browser loads the website , Client downloads resources , External system request file , Opening files through various accesses to temporary addresses is consuming CDN Traffic .
But if it's an intranet access file , I will not go CDN Flow consumption , For example, in the cloud function through fileID Access files, etc .
03、 What is? CDN Back to source traffic ?
When we have file updates in our storage , Stored in CDN How to deal with the old file of the node ? Introduce a knowledge point here —— Cache time .
The cache time here is actually the storage point of file copies in different places (CDN node ) Effective time of , For example, the default is two hours , So the effective time of each copy of the file in each storage point is two hours , When you receive a request after this time , Storage point (CDN node ) Will discard old files that are out of date , To the primary storage ( Origin station ) Request the latest file , And the traffic generated by this request is called CDN Back to source traffic .
The cache time cannot be too long or too short , If CDN Cache interval too short , that CDN Data on nodes will often fail , Cause frequent back to source , The load of the source station is increased , And then affect the overall transmission efficiency ; If the cache interval is too long , It will bring serious business problems such as untimely data update .
Cloud storage of cloud development provides very fine-grained cache time settings , You can target a file 、 A path or even a file suffix is used to set it separately .
in addition , There are also priority policies in multiple cache rule settings , Deployment becomes more flexible .
Cloud storage does policy computing in a back to front configuration mode , For example, a cloud storage domain name has the following cache configuration :
Now request resources under this path /test/abc.jpg, The matching method from back to front is as follows :
Match the first all files , hit , The cache time is 2 minute .
Match the second , Not hit .
Match the third , hit , The cache time is 300 second .
Match the fourth , hit , The cache time is 400 second .
Match the fifth , hit , The cache time is 200 second .
04、 How to reasonably control CDN?
We need to grasp a principle :
Reduce the size , Make good use of cache .
Reduce the size It means , When we develop applications , Multimedia files needed , If there are no special requirements ( For example, the original pictures of the camera are sent ), It needs to be compressed as much as possible . Only by reducing the size of business resources , Can fundamentally reduce the consumption of traffic resources .
in addition , When users upload multimedia resources , You can still use platform or framework capabilities to compress resources before uploading them , Ensure that all resources are optimized and stored , This will reduce a lot of load when you request to download .
Make good use of cache It means the same user 、 Try not to request the same resource more than once , To use the client's local caching capability properly , Cache all fixed resources . When the user enters again , Using cached resources directly .
I'd like to give you another golden sentence : The cache works well ,PV The effect is just UV The amount of .
And in specific use , We still need to reasonably grasp it according to our own business situation . For example, your resources change very frequently , It's not suitable for cache optimization ; And your resources can't be compressed , Keep it the same size , It is not suitable for compression optimization .
05、 Conclusion
The above strategy is for you hold Unable to live CDN Friends of traffic , If you think CDN Consumption is like running water , Users are active but not much better , Maybe you need to check where you waste . Thrift is a traditional virtue of the Chinese nation , Cloud development is good , We also need to use it sparingly ~
author : Yunyun senior
边栏推荐
- 2022年二级造价工程师备考攻略,你准备好了吗?
- Beauty of script │ VBS introduction interactive practice
- How to adjust the alarm information that remains unchanged after paging is selected on the easygbs alarm page?
- After purchasing Tencent ECs, how to solve packet loss in Internet access?
- Clickhouse thread occupation troubleshooting and killing
- Idea创建Servlet 后访问报404问题
- ServiceStack. Source code analysis of redis (connection and connection pool)
- How to file ECS? What should be paid attention to when selecting ECS
- Submit sitemap to Baidu
- How can the new generation of HTAP databases be reshaped in the cloud? Tidb V6 online conference will be announced soon!
猜你喜欢

Introduction à la méthode de descente par Gradient - document d'apprentissage automatique pour les programmeurs de chevaux noirs

SAP MTS/ATO/MTO/ETO专题之十:ETO模式 Q+空模式 未估价库存 策略自定义

Application practice | Apache Doris integrates iceberg + Flink CDC to build a real-time federated query and analysis architecture integrating lake and warehouse

什么是数据中台

Abnova荧光原位杂交(FISH)探针解决方案

编译器是如何将芯片执行的第一个指令放到芯片起始地址的?

阿里云混合云首席架构师张晓丹:政企混合云技术架构的演进和发展

SAP mts/ato/mto/eto topic 7: ATO mode 1 m+m mode strategy 82 (6892)

The official overclocking tool of Intel XTU supports win11 22h2 and 13th generation core Raptor Lake processors

TCPIP协议详解
随机推荐
集成阿里云短信服务以及报签名不合法的原因
『应急响应实践』LogParser日志分析实践
Multi task video recommendation scheme, baidu engineers' actual combat experience sharing
An interface testing software that supports offline document sharing in the Intranet
Abnova荧光原位杂交(FISH)探针解决方案
web渗透测试----5、暴力破解漏洞--(5)SMB密码破解
重新认识WorkPlus,不止IM即时通讯,是企业移动应用管理专家
Chemical properties and specificity of Worthington Papain
How to build a website for ECS is the price of ECS very expensive
华为云GaussDB(for Redis)揭秘第19期:GaussDB(for Redis)全面对比Codis
Wide & deep model and optimizer understand code practice
How to use and apply for ECS? What parameters can be configured
SAP mts/ato/mto/eto topic 8: ATO mode 2 d+ empty mode strategy 85
Network timeout configuration method when PR and push are proposed
Apipost interface assertion details
What is Ping? How can the server disable Ping?
Openeuler kernel technology sharing issue 20 - execution entity creation and switching
How to add a domain name to ECS? What are the advantages of ECS?
Tsingsee Qingxi video easycvr integrated Dahua face recognition equipment
Easyanticheat uses to inject unsigned code into a protected process (2)