aristidb/aws — pull request #130 by larskuhtz (2014-08-27 00:02:09+00:00)
Title: TCP connection reuse for DynamoDb

The http-client package flags TCP connection for reuse for another HTTP request only if it is guaranteed that there is no stale data from the response of the previous request in the channel. Consumption of all data is detected by reading data chunks from the response body until a final empty chunk is read that signals that the end of the input has been reached.

For certain protocols, such as JSON or XML, a consumer can determine the end of the response data without actually reading the final empty chunk. For instance for JSON the consumer simply requests data until the outermost object or array value is complete. Even though all bytes from the response are consumed and the response body reader is properly closed, the final empty chunk is not forced and reuse of the TCP connection isn't triggered.

The first patch in this series fixes the response consumer of DynamoDb to trigger the reuse of TCP connections by reading the final empty chunk that indicates end-of-stream.

The remaining patches extend the existing test code for SQS and add test code for DynamoDb to check that TCP connections are actually reused.