# Reduce requests

Right after the activation or a cache purge, Marfeel sends all the requests to the origin server, before its cache layers are full. The origin server can be overwhelmed and return a 503 response code to requests if it can't cope.

Several flags can be set in the cdn.json file of a tenant to reduce server load.

TIP

All the flags described here can also be put in place before the CDN activation, if the tenant requests it.

  1. We can enable the marfeelManShieldCache flag.
  2. We can modify Fastly's timeouts to fit the tenant's origin web server resources or deal with unstable connections.

2.1 Use case 1: the tenant's web server has low resources, which means a low-performance CPU and a small memory. In this case, we could reduce the number of connections a pop keeps alive with the desktop_max_conn flag. If needed, we could also reduce the timeouts to avoid piling up connexions to the server. If Fastly gets an error from the origin, it returns stale content due to our stale-if-error policy. See Cache Status for more details on it.

2.2 Use case 2: the tenant's web server is hosted under a poor Internet connection. We could first move the Fastly desktop shield to a location closer to the origin's webserver. Follow these steps! If needed, we could also increase the timeouts so that it waits longer before closing connexions to the origin server.

Use the 3 timeout flags combined:

You can combine all those resources in a single change:

{
  "marfeelManShieldCache": "enabled",
  "desktop_connect_timeout": 12000,
  "desktop_first_byte_timeout": 60000,
  "desktop_between_bytes_timeout": 36000,
  "desktop_max_conn": 100
}

# Move Desktop Shield

For all tenants, the desktop shield is by default in London.

To move it as close as possible to a tenant's origin server:

  1. List all of Fastly's POP locations (opens new window) via their API (opens new window).
  2. Run an IP location query (opens new window) for origin.tenant.com to get the origin server's GEO.
  3. Find a POP from the list in 1. which fits with the location you found in 2.
  4. Set it up in the CDN.json file with the 3 flags desktopShield, desktopShieldSuffix, desktopDirector

TIP

Don't know how to use the API? Ask your caching systems chapter representative.

See this implementation example (opens new window).