http/2 server push
TRANSCRIPT
What is Server Push?• One of the features of HTTP/2
• Allows sending resources to a client before the client requests them
• Avoids additional round trips
• May reduce time to first paint
• if we could use it wisely
How does it work?
Server Push
GET /index.html
GET /index.html
Client Intermediate Origin server
index.html
index.html
How can we use it on TS?• TSHttpTxnServerPush
• Introduced since 7.0
• Experimental
• An example plugin is available
#include <ts/experimental.h>
void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len)
What will happen inside?Client Http2Stream PluginHttpSM
TSHttpTxnServerPush()
hook->invoke()
Http2ClientSession
send_push_promise_frame()PUSH_PROMISE
HEADERS
send_request()handleEvent()
send_request()handleEvent()
new_transaction()
new_transaction()
hook->invoke()
What will be a problem?
Server Push
GET /index.htmlGET /index.html
?We don’t know which resources we should push.
The client may already have the resource. The push may delay the response from an origin.
What can we do?• Use Manifest files
• Use Link header
• Use Link element in a HTML document
• Use Cache Digests (a.k.a CASPER)
• Also needs client side implementation
• Use AI (machine learning)
Simple
Complex
Future plan
• Add experimental plugins
• Add Server Push metrics (maybe 7.1.0)
• Brush up the API
• Show some results in the next summit
Summary• Server Push MAY increase performance
• Server Push CAN decrease performance
• Server Push API is available since TS 7.0
• Server Push may be too complicated for human beings
WE NEED YOUR FEEDBACK!
Thank you
References• HTTP/2 Server Push
• https://tools.ietf.org/html/rfc7540#section-8.2
• Link header & Link element
• https://www.w3.org/TR/preload/
• Cache Digests
• https://tools.ietf.org/html/draft-ietf-httpbis-cache-digest-00
• Akamai - Are you ready for HTTP/2 Server Push?!
• https://blogs.akamai.com/2016/04/are-you-ready-for-http2-server-push.html
• Cloudflare - Announcing Support for HTTP/2 Server Push
• https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/
• Fastly
• https://www.fastly.com/blog/announcing-limited-availability-http2