Akka HTTP 10.2.5 released

Dear hakkers,

We are happy to announce the 10.2.5 release of Akka HTTP. This release includes a set of performance improvements in the HTTP/2 infrastructure ultimately targeting Akka gRPC performance (more news soon).

Aside from internal improvements, some performance-related changes introduce new APIs or settings:

HTTP/2: Trailers on messages with Strict entities

HTTP/2 server and client can now send Strict entities to completely avoid stream materialization overhead for common use cases that require no streaming. This required providing a new way to attach trailing headers to a message also for messages with Strict entities. For that purpose the new attribute AttributeKeys.trailer of type Trailer can be attached to a message. This is a common scenario for gRPC which uses trailing headers to transmit the status code in a response.

Streaming entities using Chunked entities can still use the LastChunk to provide trailing headers.

See Trailing Headers for more information.

HTTP/2: Collect Strict entities

HTTP/2 servers can request to produce Strict entities also for incoming requests by using the new akka.http.server.http2.min-collect-strict-entity-size setting. With that setting, the server can be instructed to hold back an incoming request to collect more data until either the request has been fully received ( Strict entity is dispatched) or the given limit of collected data has been reached ( Chunked entity is dispatched as before). This is another optimization to avoid stream materialization overhead where possible for small requests (also common with simple gRPC requests).

The setting is still disabled by default. See the accompanying comments in the reference.conf for more information.

Other notable improvements

The HTTP/1.1 client connection pool has a new keep-alive-timeout to avoid race conditions with server-side timeouts. See Keep Alive Timeout.

All Changes since 10.2.4

akka-http-core

Features
  • Add pool keep-alive-timeout #3816
  • Add flag to log WebSocket frame traffic #3739
  • Move isStrict up a level to ws.Message #3847
  • Add setting to automatically collect HTTP/2 request entity data into strict entities #3829
  • Allow trailing HTTP/2 headers on strict responses #3820
Improvements / Fixes
  • Include port in HTTP/2 binding warning #3793
  • Don’t send ‘100 Continue’ if ‘Content-Length’ header is 0, doesn’t exist or data got sent early #3786
  • Preserve original response headers during server termination #3819
  • Remove the requirement of max-open-requests being a power of two #3827
  • Add detail to onBadProtocol #2877
  • Back off on HTTP/2 client persistent connection failure #3857
  • Block demux stage completion until in-flight ops complete #3734
  • Ensure unhandled error ultimately get translated into GOAWAY frames #3839
  • Properly propagate completion through PersistentConnection #3855
  • Remove Http2FrameRendering stage #3838
  • Remove reflective access to alpn classes (JDK16 support) #3811
Optimizations
  • Cache ContentType rendering #3830
  • Cache ModeledHeader.value #3846
  • Cache lowercaseName in ModeledCustomHeaderCompanion #3851
  • Only render date-header once per second #3832
  • Don’t include RequestTimeoutSupport if disabled #3862
  • Fix UriParser constructor performance #3813
  • Increase some default buffer sizes #3863
  • A few simple microoptimizations that turned up in profiling #3872
  • Append new trailing headers at the end #3821
  • Avoid async boundary in ProtocolSwitch #3831
  • Avoid calling LoggingAdapter.isDebugEnabled in multiplexer #3869
  • Avoid creating GenericOutlet for every out element #3848
  • Avoid extra allocations in frame renderer #3823
  • Cache expensive isDebugEnabled call #3850
  • Convert stream handling map to LongMap #3845
  • Don’t recordStateChange when debug logging is disabled #3842
  • Fix window management while CollectingIncomingData #3837
  • Provide missing handling logic in CollectingIncomingData state + tests #3837
  • Import shaded twitter hpack library (APL2) #3849
  • Never create Default entity #3841
  • Optimize header parsing by caching headers in HPACK tables #3861
  • Support Strict entities in Http2SubStream #3824
  • Use ByteString.length instead of ByteString.size #3853
  • Use cached ContentType.value instead of toString #3865
  • Use mutable.Queue for state in multiplexer #3873

Build

  • Update caffeine from 2.8.8 to 2.9.0 #3768
  • Update github-api from 1.122 to 1.123 #3777
  • Update to Scala 2.13.5, 2.12.13 and scalafix 0.9.26 #3780
  • Finally update to sbt 1.4.7 #3781
  • Publish to sonatype directly #3792
  • Import shaded twitter hpack library (APL2) #3849
  • Update dependencies #3870
  • Disable parallel test execution during Github Actions runs #3866
  • Run full validation when workflow definition has changed #3881

Credits

The complete list of closed issues can be found on the 10.2.5 milestone on GitHub.

For this release we had the help of 17 contributors – thank you all very much!

commits added removed
52    4319    1141 Johannes Rudolph
 4     222      51 Arnout Engelen
 2     133      20 Johan Andrén
 2     129       6 Matthias Kurz
 2       2       2 Scala Steward
 1       1       1 Justin Pihony
 1     151      23 Renato Cavalcanti
 1     325      56 Ignasi Marimon-Clos
 1       3      16 Rafał Sumisławski
 1     117      22 Nitika Agarwal
 1       1       1 Matt Fulgo
 1       1       1 Roberto Tyley
 1       1       1 João Ferreira
 1       7       6 Alec Theriault
 1      36      18 Matthew de Detrich
 1       5       4 Kyrylo Stokoz
 1       1       1 Casper Lehmann-Strøm

Akka by Lightbend

The Akka core team is employed by Lightbend. If you’re looking to take your Akka systems to the next level, let’s set up a time to discuss our enterprise-grade expert support, self-paced education courses, and technology enhancements that help you manage, monitor and secure your Akka systems - from development to production.

Happy hakking!

– The Akka Team

1 Like

Just a quick update that we released a 10.2.6 fixing a critical bug shortly afterwards. See Akka HTTP 10.2.6 Released | Akka for more information.

After updating to 10.2.6 version I started seeing the following error in my application for every request
HTTP2 connection failed with error [HTTP idle-timeout encountered, no bytes passed in the last 60 seconds. This is configurable by akka.http.[server|client].idle-timeout.]. Sending INTERNAL_ERROR and closing connection.
I believe it comes from
this method https://github.com/akka/akka-http/blob/1088de3468cb3e488a8a4334226e8562cd3f10c5/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2Blueprint.scala#L161

I’m using the default value 60s for akka.http.server.idle-timeout. Is there a way to mute this exception?

1 Like