The ZEIT Network layer sits in-between the internet and your ZEIT Now deployments. This type of network topology is sometimes called a Content Delivery Network or CDN.
The ZEIT Network has many responsibilities, but most importantly, it is responsible for routing requests to the correct Lambda or Static File output of your Builds. Since the ZEIT network is a CDN with the ability to execute functions at the edge, the ZEIT Network is a Smart CDN.
In order to route requests as fast as possible, the Network layer is running in dozens of locations across the world. In all of these locations (called Regions), you can create Deployments that create Builds outputting Lambdas and/or Static Files. The full list of regions can be found here.
In turn, the Network layer will automatically forward incoming requests to the closest location in which your Lambda is running (Static Files are always distributed across the whole network, thus not location-specific).
In the event that the Lambda of your deployment is not created in the requested region, the request is forwarded to the closest region that contains your deployed Lambda.
The ZEIT Network has multiple layers of caches to ensure that your Now deployments are fast around the world. At a high level, the layers of the cache are as follows:
- L1 - a small per-process cache
- L2 - shared cache for processes on a single node
- L3 - a regional cache that is shared with all nodes in a region
- Origin - A Lambda invoked or Static File fetched on cache miss
Aside from routing your requests to the correct destination, the Network layer also takes care of a few other important aspects of a working Deployment:
- Terminating SSL
- Compressing your responses
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.