Amazon Web Services (AWS), introduced a new HTTP client this week for the AWS SDK Java 2.0.
The AWS Common Runtime HTTP Client (CRT HTTP) was released as a preview. It is an asynchronous, nonblocking HTTP client that is built on top the Java bindings of AWS Common Runtime.
Zoe Wang, AWS software developer, wrote in a blog post that “You can use CRT HTTP client for features such as improved performance and connection health checks and post-quantum TLS [Transport Layer Security] support.” In her blog post, Wang explains in detail how to use AWS CRT HTTP Client.
The AWS SDK Java 2.0 was first presented in 2017. It was a major rewrite and rewrite of Java 11.x. It was built on Java 8 and included many frequently requested features such as non-blocking I/O support and the ability to use an alternative HTTP implementation at runtime.
This is the second Java SDK-supported first-party asynchronous HTTP Client. The Netty HTTP Client was the first.
The CRT HTTP client has many other benefits. It reduces the startup time of the SDK. According to AWS, the client is able to start cold faster than other HTTP clients that are supported by the SDK. In fact, current customers of the NettyNioAsyncHttpClient could see performance improvements of up to 46 percent, Wang said, depending on the application configuration. “In addition to cold start improvements,” Wang said. “When we compared NettyNioAsyncClient with CRT HTTP client in our local testing using Java Microbenchmark Harness, (JMH), we saw throughput improvements of up to 17 percent for concurrent API call and up to 32 percent sequential API calls.”
The CRT HTTP client now supports DNS load balancing. The Java Virtual Machine (JVM), which caches DNS name lookups, does so for a specified time period known as the time to live (TTL).
Wang explained that DNS name entries used in AWS services may occasionally change. Therefore, it is important to set the TTL value to a smaller value so that it periodically refreshes its cached IP data. Customers may need to manually set the TTL value via the system property. This is often done with existing HTTP clients. It can often take extensive research and testing to find the right value.
Wang explained that the CRT HTTP client features an asynchronous DNS resolver, which polls each requested DNS address at a regular interval. Customers don’t have to set the TTL value.
The CRT HTTP client allows users to configure connection monitoring options. A feature in the AWS Key Management Service(AWS KMS), which adds new, postquantum cipher suites for connecting to AWS KMS API endspoints, also allows users to configure health checks. Wang stated that “Post-quantum TLS provides additional security to protect your TLS traffic against being decrypted in the future by a large-scale quantum computing machine.”
This release has a short list of limitations. The CRT HTTP client supports only HTTP/1.1 protocol. It cannot be used with SDK clients that need HTTP/2 support. Wang stated that while client-side metrics are generally accessible, specific HTTP metrics for CRT are not yet implemented. “We plan to implement this feature, which will allow you to detect, diagnose and monitor the resources within the CRT HTTP Client, in a near future.”