Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CDN for a RESTful API?

Tags:

rest

cdn

I have a RESTful API with resources updates once a week. That is, for each resource, I update it once and week and allow clients to access it. It's an ever changing calculator.

There are probably 10,000 resources which could be requested.

Is it possible to put something like this behind a CDN? Traditionally CDNs are for undeniably static content, ie images. I'm not sure where my situation sits in the spectrum of dynamic <-> static.

Cheers

like image 572
Max Avatar asked Apr 14 '14 03:04

Max


People also ask

Can you use a CDN for an API?

A CDN can make your APIs faster, more reliable, and more scalable by caching data at the edge. So when you design your API, think about structuring your data between what can be reused (therefore cached) and what cannot be cached.

What is API CDN?

APIs are the building blocks used to send, receive, and modify business-critical data. But, while APIs enable a more dynamic shopping experience, performance is often a challenge. Content delivery networks (CDNs) are typically used to enhance web and mobile performance.

What does CDN stand for?

A CDN (content delivery network), also called a content distribution network, is a group of geographically distributed and interconnected servers. They provide cached internet content from a network location closest to a user to speed up its delivery.

How CDN is powerful in web development?

Instead of having to connect to wherever a website's origin server may live, a CDN lets users connect to a geographically closer data center. Less travel time means faster service. Hardware and software optimizations such as efficient load balancing and solid-state hard drives can help data reach the user faster.


1 Answers

90% of the resources might not even get called, and if they are, will get called a few times only. It wont be a mass of repetitive calls.

Right there in your comments, you just showed me that a CDN is not beneficial to you.

Usually how a CDN works is the first call it is downloaded from the main server to the regional CDN node then delivered to the client meaning the first GET will have no improvements. The following GETs to the same regional node will have the speed improvement. If you have little to no repetitive calls, then you will not see any noticeable improvement.

As I said in the comments, for small files, clients are probably spending as much time on the DNS lookup as they are on the download. Look into a global DNS solution (like Anycast) to reduce connection times. This is easy to setup and requires little to no maintenance.

like image 196
Devon Avatar answered Oct 02 '22 12:10

Devon