Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ESUG17: HTTP/2 in Cincom Smalltalk™ SiouX Server

89 views

Published on

A presentation on HTTP/2 in Cincom Smalltalk at the 2017 European Smalltalk User Conference.

Published in: Software
  • Be the first to comment

  • Be the first to like this

ESUG17: HTTP/2 in Cincom Smalltalk™ SiouX Server

  1. 1. The 25th Annual European Smalltalk User Group Conference September 4, 2017 HTTP/2 in Cincom Smalltalk ™ SiouX Server Speaker: Jerry Kott, OSCP
  2. 2. Proprietary & Confidential HTTP: A Bit of History • 1965: ‘hypertext’ coined byTed Nelson for Xanadu project • 1989: original HTTP and HTML at CERN (Tim Berners-Lee) • 1991: HTTPV0.9 - first documented version. https://www.w3.org/Protocols/HTTP/AsImplemented.html • 1996: HTTP/1.0 - first version as an RFC (1945 https://tools.ietf.org/html/rfc1945) • “This memo provides information for the Internet community. This memo does not specify an Internet standard of any kind…” • 1997: HTTP/1.1 standard released as RFC 2068 @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  3. 3. Proprietary & Confidential HTTP: A Bit of History • 1999: HTTP/1.1 updates and improvements as RFC 2616 …15 years… • 2014: HTTP/1.1 split into six different specification parts, obsoletes RFC 2616 • 2015: HTTP/2 published as RFC 7540 (https://tools.ietf.org/html/rfc7540) @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  4. 4. Proprietary & Confidential HTTP: A Bit of History • 1999: HTTP/1.1 updates and improvements as RFC 2616 …15 years… • 2014: HTTP/1.1 split into six different specification parts, obsoletes RFC 2616 • 2015: HTTP/2 published as RFC 7540 (https://tools.ietf.org/html/rfc7540) @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  5. 5. Proprietary & Confidential HTTP/2 Design • Semantically compatible with HTTP/1.1 • Clients and servers negotiate which version to select (1.1 or 2) • Improved page loading performance, e.g.: • HTTP header compression • Server push • Request pipelining • Stream multiplexing over a singleTCP connection • Web browsers support HTTP/2 only overTLS @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  6. 6. Proprietary & Confidential HTTP/2 Key Points • Semantically compatible with HTTP/1.1 • Clients and servers negotiate to select version 1.1 or 2 • Fairly rapid adoption rate • Improved page loading performance, e.g.: • HTTP header compression • Server push • Request pipelining • Stream multiplexing over a singleTCP connection • Web browsers support HTTP/2 only overTLS @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  7. 7. Proprietary & Confidential HTTP/2 Adoption Rate @cincomsmalltalk #ESUG17 HTTP/2 is used by 15.6% of the top 10 million websites. https://w3techs.com/technologies/details/ce-http2/all/all COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  8. 8. Proprietary & Confidential Components of HTTP/2 • Stream • Message: request or response • Frame: smallest part of HTTP/2 traffic • Frame types: • Control (e.g.: Priority, Header, Continuation, …) • Data • Frames may be interleaved @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  9. 9. Proprietary & Confidential HTTP/2 in SiouX Server • Preview was included in Cincom®VisualWorks® 8.2 • Full protocol implementation coming up inVisualWorks 8.3 • Supports both open and secure version. • Added requirements on Cincom Smalltalk security frameworks • HTTP/2 overTLS required by web browsers • TLS cipher suites with AEAD ciphers • Stream multiplexing, prioritization, dependencies • Challenging but also kind of fun @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  10. 10. Proprietary & Confidential Header Compression @cincomsmalltalk #ESUG17 HTTP/1.1 POST /http2_test HTTP/1.1 Host: www.examples.org Content-Type: text/plain Content-Length: 10 98 bytes HTTP/2 :method POST :scheme http :path /http_test :authority www.example.org content-type text/plain content-length 10 HTTP/2 encoded bytes: :method POST -> #[131] :scheme http -> #[134] :path /http2_test -> #[68 136 98 116 166 177 68 146 161 63] :authority www.example.org -> #[65 140 241 227 194 229 242 58 107 160 171 158 201 191] content-type text/plain -> #[95 135 73 124 165 138 232 25 170] content-length 10 -> #[92 2 49 48] 39 bytes COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  11. 11. Proprietary & Confidential Header Compression @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  12. 12. Proprietary & Confidential Multiplexing • Multiple interleaving requests over a singleTCP connection. • Traffic is broken down into frames representing pieces of virtual HTTP streams • A stream represents an HTTP request/response pair @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  13. 13. Proprietary & Confidential Multiplexing • HTTP2ServerMultiplexer in SiouX-Http2 parcel • HTTP/1.1 socket accept: -> HttpConnection ~ Process ~ RequestContext • ManyTCP connections, one process per connection • HTTP/2 socket accept: -> HttpConnection ~ Process ~ (upgrade) HTTP2ServerMultiplexer header frame read from socket: -> id -> HTTP2ServerStream ~ Process ~ RequestContext • FewTCP connections, several processes per connection @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  14. 14. Proprietary & Confidential Stream Prioritization • Weight: a stream’s weight determines its processing priority relative to other streams • Dependency: a stream may depend on another stream being processed first • Web browser support for prioritization is evolving (Chrome vs. Firefox vs. IE …) @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  15. 15. Proprietary & Confidential Stream Prioritization @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  16. 16. Proprietary & Confidential Flow Control • Credit-based system • A peer advertises resource availability • Clients and servers must keep track of the amount of resources sent to the peers • Highly customizable settings allow the control of memory allocation for read & write buffers INITIAL_WINDOW_SIZE MAX_FRAME_SIZE … • Some settings may be negotiated ‘on the fly’ as resource availability changes @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  17. 17. Proprietary & Confidential Server Push • Replaces inlined resources • Server pushes them to the client to initiate caching without a round-trip request/response. • Consider carefully when to use it (not always beneficial) @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  18. 18. Proprietary & Confidential Server Push @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  19. 19. Proprietary & Confidential SiouX HTTP/2 Code Samples server := Server id: 'MyServer'. listener := server listenOn: 8000 for: SiouX.HttpsConnection. server addSecureListener: listener certificateFile: 'certificates.pem' privateKeyFile: 'privatekey-rsa.key'. listener useHTTP2Protocol. server start. @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  20. 20. Proprietary & Confidential Settings Control “ ConfigureTLS context to ensure HTTP/2 supported cipher suites and ALPN extension are present. TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 is a mandatory cipher suite. ” listener tlsContext suites: (TLSCipherSuite suites: #(tls12 (#ecdhe #(#sha256 #sha384)))); addExtension: Xtreams.TLSAppLayerProtocolNegotiation defaultH2. version := Protocols.HTTPv20 new. listener protocolVersions: (Array with: version). @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  21. 21. Proprietary & Confidential Settings Control “Default settings may be changed according to application needs, e.g.:” version settings maxConcurrentStreams: 200; maxFrameSize: 1024 * 32; … outputWindowSize: 1024 * 64; “not part of spec, an internal optimization mechanism” … @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  22. 22. Proprietary & Confidential Configure Server Push “Server push must be enabled explicitly” version settings enablePush. “An HTTP response must receive #preloadLink for each resource to be pushed. Consider which resources to push carefully.Typically useful only on a first page load.” aResponse contentType: 'text/html'; preloadLink: self path, '/someCss.css'; preloadLink: self path, '/someJS.js'; … contents: '<HTML><BODY>some html</BODY></HTML>’. @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  23. 23. Proprietary & Confidential How About AppeX? • All SiouX functionality inherent in AppeX • Potential performance benefits: • Single PageApplication loads HTML only once • HTTP/2 server push can downloadCSS and JS into the client as HTML loads • After initial load, only data travels between the client and the server • Perceived performance improvement may be relatively small on the client BUT • Much less demand on the server @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  24. 24. Proprietary & Confidential Demo: HTTP/2 Compared to HTTP/1.1 • Inspired by akamai http2 demo: https://http2.akamai.com/demo • The same application runs in two <iframe> elements • 400 tiles make up the final image. • HTTP/1.1: 400 requests on four connections • HTTP/2: 400 requests on one multiplexed connection • The only difference is in SiouX listeners’ configuration @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  25. 25. Proprietary & Confidential Demo: HTTP/2 Compared to HTTP/1.1 @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  26. 26. Proprietary & Confidential Demo: HTTP/2 Compared to HTTP/1.1 @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  27. 27. Proprietary & Confidential Demo: HTTP/2 Compared to HTTP/1.1 • In terms of bandwidth efficiency (network time): • HTTP/1.1: 5 * 6.01 ~ 30 seconds • HTTP/2: 1 * 2.72 ~ 2.72 seconds • HTTP/2 is a clear winner @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  28. 28. Proprietary & Confidential Request Multiplexing @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  29. 29. Proprietary & Confidential (Some of) HTTP/2 Best Practices • It’s all about performance • Don’t concatenate files • an HTTP/1.1 optimization technique to reduce number of requests. • It can lead to expensive cache invalidation in the client, actually reducing performance • Don’t inline assets • special case of file concatenation • use server push instead, if / when appropriate • Minimize the size of HTTP requests / responses • Send the minimum amount of data to make your application work • Use AppeX ! @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  30. 30. Proprietary & Confidential Issues • Increased memory demands on the server because of multiplexing - any server, not SiouX specifically • Added complexity of secure certificate management andTLS configuration • Using server proxies becomes tricky • e.g.: Apache has to be built from source, explicitly enabling HTTP/2 • The mod_proxy_http2 module is experimental • Limited debugging with network sniffing tools - traffic is encrypted @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  31. 31. Proprietary & Confidential Summary and Conclusion • HTTP/2 is semantically compatible with HTTP/1.1 • But vastly different in specs and implementation • Impressive performance gains • Many optimization options • Security built in because of browser vendors constraints • A simple API for SiouX server HTTP/2 configuration • Continuing work on enhancements and performance optimization @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  32. 32. Proprietary & Confidential Additional Resources • https://hpbn.co/http2/ • http://httpwg.org/specs/rfc7540.html • https://docs.google.com/document/d/1K0NykTXB bbbTlv60t5MyJvXjqKGsCVNYHyLEXIxYMv0/edit# heading=h.ke8t5vjw3jh4 @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  33. 33. Proprietary & Confidential Contact Us Suzanne Fortman Director of SmalltalkGlobalOperations sfortman@cincom.com @SuzCST (Twitter) ArdenThomas Product Manager athomas@cincom.com @ArdenTCST (Twitter) Jerry Kott jkott@cincom.com @cincomsmalltalk #ESUG17COMPANY CONFIDENTIAL | ©2017 Cincom Systems, Inc. All Rights Reserved.
  34. 34. ThankYou! Any questions?
  35. 35. Cincom, the Quadrant Logo, Cincom Smalltalk, Cincom ObjectStudio and Cincom VisualWorks are trademarks or registered trademarks of Cincom Systems, Inc. ©2017 Cincom Systems, Inc. All Rights Reserved

×