Performance guide
Improve application latency, cache efficiency, build speed, and Function resource usage on Easel.
Application performance on Easel depends on delivery, caching, Function execution, external dependencies, and browser behavior.
Start with request details
Measure before changing configuration. For a slow request, identify:
- Whether it was served from cache, static output, or a Function
- Delivery and Function region
- Function duration and initialization state
- Time spent in external databases or APIs
- Response size and compression
- Trace spans and application logs
Prefer static output
Generate static pages and assets when content does not require request-time execution. Static output avoids Function startup and external service latency.
Cache complete responses
Use shared-cache directives for responses that can be reused. Verify the actual X-Easel-Cache result rather than assuming a route is cached.
Do not cache personalized responses unless the cache key safely separates users.
Cache application data
Use Runtime Cache for database results or expensive computations that are reused across requests. Keep CDN response caching and Runtime Cache conceptually separate.
Reduce dependency latency
Dynamic request latency often depends more on databases and external APIs than on application code. Choose compatible regions, reuse connection pools, parallelize independent calls, and set explicit timeouts.
Keep Functions concurrency-safe
Easel Functions can process overlapping requests. Reuse concurrency-safe clients, but do not store request-specific state in mutable module-level variables.
Stream intentionally
Streaming can improve time to first byte and perceived responsiveness, but the Function remains active until execution and response delivery finish. Streaming is not a substitute for caching or bounded execution.
Optimize assets
- Cache fingerprinted assets for a long duration.
- Compress eligible text responses.
- Use responsive images.
- Avoid shipping unused JavaScript.
- Preload only critical resources.
Improve builds
Commit lockfiles, avoid unnecessary monorepo rebuilds, cache dependency work where supported, and keep build scripts deterministic.
Validate changes
Compare Preview deployments using the same route, data conditions, and geographic test location. Confirm that an improvement does not increase error rate, stale content, or resource usage.