- Building Serverless Web Applications
- Diego Zanon
- 290字
- 2021-07-15 17:31:30
Amazon CloudFront
CloudFront is a Content Delivery Network (CDN). It is a special service with the objective of improving your website speed and availability. It achieves this by reducing the distance between users and files using Amazon's infrastructure around the world, which contains more than 60 edge locations, where each one of them can be used to host copies of your files.
A signal traveling at light speed from Sydney (Australia) to New York (USA) takes 53 milliseconds. A ping message needs a roundtrip, covering twice the distance and taking double the time. Also, there are other factors that increase this time: light travels 33% slower on fiber optics (glass), there is no straight line connecting both cities, and equipment like repeaters and switches will slow down transfer speeds. The result is a measured latency between 200 milliseconds and 300 milliseconds. By comparison, providing the content in the same city may reduce the latency to 15 milliseconds.
This difference is usually not significant for most applications. In a serverless website, the cold start delay has a bigger impact. If your use case is very sensitive to high latencies, you should avoid serverless or you can use CloudFront to minimize the impact, at least in the frontend.
To reduce costs, CloudFront won't replicate your content automatically throughout the world. It will replicate only where a demand for it exists. For example, when a request is made from a British city, the DNS will route the request to the nearest edge location and if it does not have yet a local copy of the file, it will be copied temporarily (cached). When another user in a nearby city requests the same file, it will benefit from a lower latency and fast response.
- Cocos2D-X權(quán)威指南(第2版)
- Mastering JavaScript Object-Oriented Programming
- RTC程序設(shè)計(jì):實(shí)時(shí)音視頻權(quán)威指南
- C語(yǔ)言從入門(mén)到精通(第4版)
- 你必須知道的204個(gè)Visual C++開(kāi)發(fā)問(wèn)題
- TradeStation交易應(yīng)用實(shí)踐:量化方法構(gòu)建贏家策略(原書(shū)第2版)
- .NET 3.5編程
- BIM概論及Revit精講
- D3.js By Example
- 區(qū)塊鏈技術(shù)進(jìn)階與實(shí)戰(zhàn)(第2版)
- Clojure Polymorphism
- 百萬(wàn)在線:大型游戲服務(wù)端開(kāi)發(fā)
- C語(yǔ)言程序設(shè)計(jì)教程
- HTML5+jQuery Mobile移動(dòng)應(yīng)用開(kāi)發(fā)
- 計(jì)算機(jī)視覺(jué)實(shí)戰(zhàn):基于TensorFlow 2