Ian Bennett

@enbnt

Posted February 27, 2020

🍂 Fall/Winter ❄️ 2019 Quarterly Review

Hi Finaglers,

It is ⌛time to take a 👀 look back on the 🌇 twilight of the year 2019, when the seasons shift from 🍂 Fall to Winter ❄️. Across our projects, we have introduced support for JDK 11 and added support for Scala 2.13 across a large portion of our projects. A major thanks due to our OSS community contributions on continuing to drive Scala 2.13 support - we couldn’t have made such progress so quickly without your help. We have made some steady progress and improvements across all of our projects, but also want to loop you in on some of our plans looking forward to Spring 🌱.

Finatra

We have introduced a new Case Class Validation library (finatra/validation), upgraded some dependent libraries, squashed some bugs, and moved some things around. Automatic handling of Mustache rendering has been removed from finatra/http and Mustache support has been broken into two separate libraries: finatra/mustache and finatra/http-mustache. Please realize that we try to minimize breaking API changes unless they’re absolutely necessary and we apologize for the inconvenience when upgrading. Much of the movement is to clean up inconsistencies or poor layout of existing APIs and in service to some bigger things coming.

You should expect to see improvements to the usability of our new Case Class Validation library, bug fixes and broader support for Jackson annotations within finatra-jackson, and the removal of finagle-http as a dependency within finatra-jackson as we move into Spring 🌱. We are also looking into shifting Finatra’s HTTP path DSL to be based off of the OpenAPI spec and more information will follow as those plans solidify.

We have continued to refine the APIs around c.t.util Streaming types (Reader, Writer, Pipe). We improved the performance of Reader. We have removed the deprecated response.StreamingResponse. StreamingResponse and StreamingRequest are the recommended Finatra Streaming APIs.

Finagle

Martijnhoekstra added a new HeaderMap to the finagle-http project! We made this implementation the default HeaderMap implementation, resulting in improved performance - most notably in HTTP and HTTP/2 servers.

Check out the blog post on our homemade ◎ Deterministic Aperture Load Balancer ◎!

We focused on improving Tracing support within Finagle, including adding local tracing support (1c6d5d24), annotations to DarkTrafficFilter based requests (ba351f4d), microsecond resolution timestamps in JDK9 or later (08a926c6), and changes to Trace#time and Trace#timeFuture to create BinaryAnnotations with timing information (c6d5d24), along with the deprecation of Tracing#record(message, duration) (1c6d5d24).

We improved the finagle-mysql project by adding native support for the MySQL JSON Data Type(4d403051).

The finagle-partition, finagle-exception, finagle-exp, finagle-mysql, finagle-mux, finagle-thrift, finagle-thriftmux, finagle-redis, finagle-tunable, and finagle-grpc-context projects have added Scala 2.13 cross-build support. Once again, thank you to martijnhoekstra, joroKr21, DieBauer, hderms, and spockz for all of the great work!

Per-method stats creation is now lazy, thanks to changes in Scrooge client endpoint metrics (6be5dc48).  This decreases the number of metrics that are created when talking to services that have many endpoints, few of which you use.  We also reduced the number of metrics we export in general, making some verbose, and removing some unnecessary ones. To demonstrate the effect: this work retires at least ~50 metrics from a bare bones Finagle application (1 client; 1 server).

We added compression negotiation support to ThriftMux. This makes it easy to roll-out compression between two services, so that service owners can make better tradeoffs between network bandwidth and CPU.  We’re still experimenting with this feature, but please reach out to csl-team@ if you would like to be involved in trying it out!

The finagle-http clients that are HTTP/2 enabled, which is toggled on by default at Twitter, now have flow control (back-pressure) support by default. This implementation is based off of Netty’s MultiplexHandler. Our legacy HTTP/2 client implementation (without flow control) has been removed. There is additional clean-up around handling of exceptions and nacks that improved the overall HTTP/2 experience.

Looking to the Spring🌱, we have our eyes set on adding partition awareness support for Thrift and ThriftMux clients. This is a tool that could be leveraged to handle load balancing across stateful shards (i.e. partitioned storage). In a similar vein, we are looking to introduce protocol-agnostic routing constructs that will be leveraged at various points (HttpMuxer, Twitter Server Admin, Finatra) and expect some deprecations of current APIs as a result. We have also been and will continue to experiment with and roll out eager connection/session establishment for users of the ◎ Deterministic Aperture Load Balancer ◎.

Twitter Server

We changed query parameter retrieval in order to remove duplicate functionality from Twitter Server that already exists within Finagle (b538228c). You can also now disable the AdminHttpServer from starting (ecef399a) by default on a TwitterServer.

Util

Twitter Futures can now convert to the newer Java CompletableFuture APIs, to improve our Java friendliness, and make it easier to integrate with modern Java libraries.

We added a new c.t.f.stats.LazyStatsReceiver, which ensures that counters and histograms don’t export metrics until after they have been incremented or added to at least once. This should make it easier to create metrics that you don’t want to export unless they’re used.

We added support for nowNanoPrecision to c.t.u.Time to produce nanosecond resolution timestamps in JDK9 or later.

Scrooge

We looked hard at how to improve generic processing of Thrift data.  Historically, the only first class support for data processing was if you were processing a single Thrift type, so it was challenging to write libraries that could deal with arbitrary Thrift types.  To that end, we improved ThriftStructMetaData so that it didn’t have to use reflection by default.  We also addedStructBuilder to ThriftStruct to better support copy and modify patterns.

Scrooge is also going to be a focus heading into the Spring 🌱, as we’re looking to improve the relationship and efficiency between Scrooge and Finagle. 

Libraries Upgraded

Closing

If all of this excites you and you’d like to work alongside us, not only do we love working with external contributors, but we are hiring! Take a look at careers.twitter.com and join the Flock!

Thank you all and here is to a ✨magical ✨ year ahead,

Ian on behalf of CSL