Skip to content

reuse HTTP connections#24

Open
ghost wants to merge 1 commit into
kzk:masterfrom
Altiscale:dc_reuse_http_connections
Open

reuse HTTP connections#24
ghost wants to merge 1 commit into
kzk:masterfrom
Altiscale:dc_reuse_http_connections

Conversation

@ghost

@ghost ghost commented Oct 23, 2015

Copy link
Copy Markdown

This change provides the ability to use the HTTP connection multiple times. The HTTP connection can now be reused over consecutive calls to the same host:port combination. Experience with this optimization on Altiscale's infrastructure indicates that it can improve application-level performance by a factor of 2.

The new reuse_connection class variable is set to false (disabling the new functionality) by default, so that existing clients can rely on the original semantics of the class. For example, some clients might depend on the ability to change class variables (e.g. open_timeout) between calls to the request method. Changing class variables between calls to request is not supported with the reuse_connection optimization.

The connection set-up code that was in the request method has been refactored into the private create_connection method, which is called by the private connection method. The reuse optimization is implemented by the private connection and reuse_connection_if_possible methods.

@tagomoris

Copy link
Copy Markdown
Collaborator

I have some points:

  • What's happen when servers (NameNode, DataNode and/or HttpFs server / reverse proxies) disconnects keep-alived connections?
  • With WebHDFS (not HttpFs), clients send two requests to write data on HDFS, to NameNode and DataNode
      1. request to NameNode (finish connection to DataNode if exists, and cache connection to NameNode)
      1. request to DataNode (finish connection to NameNode, and cache connection to NameNode)
  • Is it intentional? It looks better for me to cache connections for each host-port pair.

@ghost

ghost commented Nov 12, 2015

Copy link
Copy Markdown
Author

Thanks for the comments, and sorry for the delay in my response! I thought about these issues when writing the code, and will write a detailed response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant