Edgio

Performance

This guide shows you how to monitor and improve the performance of your application running on Edgio.

Built-in Timings

All responses contain an x-0-t header that contains the time the request spent at each layer of the Edgio stack.

Tracking your Own Timings

You can use the @layer0/core/timing module to track how long it takes parts of your code to execute. A common case is tracking how long it takes to fetch a result from an upstream API. For example:
JavaScript
1import Timing from '@layer0/core/timing'
2
3const timing = new Timing('api').start()
4
5try {
6 const result = await fetch(API_URL)
7} finally {
8 timing.end() // this will result in a `x-0-user-t: api=(millis)` response header
9}
  • All timings are returned in an x-0-user-t response header.
  • The value is a comma-delimited list of pairs of the form (name)=(duration-in-millis).
  • The value of this header will be logged into xut field in access logs. The logged data is limited to 50 bytes after which it will be truncated.
  • Any timings that are not ended before the response is sent will have a value of na

Performance Optimizations

Turn off Caching When not Needed

For GET routes that you know you will not or must not cache, always explicitly disable caching. This indicates to Edgio that it should not try to coalesce requests which leads to improved performance especially on slower upstreams.
For example, if you know that nothing from your legacy upstream will or can ever be cached, do this:
JavaScript
1new Router().fallback(({ proxy, cache }) => {
2 cache({
3 edge: false,
4 })
5 proxy('legacy')
6})