🖊️

Vercel Edge Network

Tags
Nextjs
network
Date
2021/03/15
속성
Vercel Edge Network 는 internet 과 Vercel deployment 사이에 위치하는 network topology(CDN으로 불리기도 함) 다. 프로젝트 builds 결과물의 static file 과 serverless function 요청에 대해서 라우팅시켜준다.

regions

가능한 빠른 응답을 위해서 vercel 에서 수십개의 region 들을 운영하고 있음 (region list)
Edge Network 는 수신요청을 serverless 기능이 실행중인 가장 가까운 region 으로 forward 시킴. (static files 는 전체 네트워크로 분배되기 때문에 location 과 상관없이 요청됨)

cache

Edge Network 는 모든 deployment 에 대해서 static cache 는 자동으로 적용된다 (zero config 로 performance optimize 가 어느정도 구성되어있음)
GET, HEAD 요청에 대한 200, 400, 301, 308 응답은 모두 CDN 에 의해서 cache 된다. (다른 상태 코드는 안됨)

static files

static file 들은 첫 번째 요청 이후 모두 자동으로 cache 된다. static file 은 최대 31일 동안 캐시됨.

serverless functions

api 라우트 안에 있는 요청들은 자동으로 serverless 로 생성이 되는데, 이 serverless 의 결과에 대해서 cache 를 하려면 Cache-Control 을 response header 에 포함시켜야함. (참고)

chache invalidation

매 배포 버전마다 unique 한 cache key 를 build time 에 생성하기 때문에 배포 후 따로 무효화 처리 할 필요가 없음. 새로운 배포가 만들어지면 이전 배포버전의 캐시는 삭제된다.

Limits

Max Cacheable Response Size = 10MB
Max Cache Time = 31 days
s-maxage
max-age
stale-while-revalidate
Note: The s-maxage header is best-effort, not guaranteed.
Aside from routing your requests to the correct destination, the Edge Network also takes care of a few other important aspects of a working Deployment:
All of these actions are performed automatically with careful attention to performance (ensured by our choices of technology). In turn, we highly recommend not implementing SSL termination or compression in your own code, as it would be unnecessary.
The Edge Network supports the following protocols (negotiated with ALPN):