Optimize Text Streaming (Beta)
The Optimize Text Streaming behavior is in Beta and must be added by your account team.
Use this behavior to optimize your delivery configuration for text streaming applications. This behavior minimizes latency by streaming a response from an origin server to the client as the response is dynamically generated. Examples of use cases include AI applications using Server-Sent Events (SSE), streamable HTTP, and HTML streaming with Next.js.
While it's common that the objects delivered are in text format for targeted applications, the optimization is not restricted to just text objects.
How it works
The Optimize Text Streaming behavior relays content from the origin without performing additional compression or decompression on the object to minimize latency. Objects can be compressed at the origin if you want to optimize the delivery efficiency. Response buffering is disabled, and chunked transfer encoding is used whenever applicable.
Features and options
| Field | What it does |
|---|---|
| Enable | Use this option to enable the Optimize Text Streaming feature. |
Implementation
Set your Criteria to one of the following match conditions. Once your criteria is set, insert the Optimize Text Streaming behavior on your conditions:
- Specific URL or hostname like www.example.com
- File extension like .jpeg or .txt
- Request header like
Cookie: sessionId=123 - Content type like
application/json
Caveats and known issues
| Issue | Detail |
|---|---|
| Advanced metadata | The Optimize Text Streaming behavior may conflict with Advanced behaviors, override, or metadata if metadata tags used in the optimization are also applied in your Advanced configuration. Contact your account representative or see Advanced for more info. |
Security products addendum
- Disabling response buffering negatively impacts several security products by preventing response body inspection on that slice of traffic (e.g., detecting data leakage or assessing transaction success/failure in some cases etc). For example:
- API Security will be non-functional, collecting no data and providing no visibility for the SSE optimized traffic slice.
- Bot and Abuse Protection (BAP) and Firewall for AI (FAI) will be significantly restricted - especially BAP features that rely on inspecting the response body (like successful transaction analysis).
- App & API Protection (AAP) can’t run detections based on the response body. All other AAP protections (rate limits, most WAF rules, etc) will continue to work.
- Your trade off options are:
- Delivery Optimized: Disable buffering. This ensures low-latency streaming but severely impacts API Security, FAI, and BAP, and limits AAP. We strongly recommend doing this only on the slice of traffic that needs to be optimized for functioning as expected.
- Security Optimized: Enable buffering. This ensures full security functionality but may introduce delays for streaming applications (e.g., chat, audio streams).
- Akamai is actively working to build better compatibility between SSE and our security products to reduce this performance-security trade-off in the future.
Updated about 2 hours ago
