On Tue, Jun 11, 2013 at 3:22 PM, Ivan Zhakov <i...@visualsvn.com> wrote: > Hi, > > Currently Subversion client layer creates new RA session for every > svn_client_* call. Even more: for some operations like > svn_client_merge() it creates 10-15 RA sessions. Each session creation > takes significant amount of time: TCP connection, SSL handshake, > authentication and initial handshake. It easily could take several > seconds over WAN. > > To solve this problem I propose to introduce RA context abstraction > layer for managing set of RA sessions for different repositories and > reuse them if possible. In the first version I made this layer > libsvn_client private, but in we can make it part of ra-loader in > future. > > The patch is attached. It passes all tests of course. I'm very > interested for feedback. Proposed solution should make our svn merge > code much easy to maintain and significantly faster. > I'll try to summarize concerns that were raised during the Hackathon and on mailing list: 1. svn_client_context_t can be used for long time by GUI clients. We need to deal with somehow. 2. De-facto ra_svn is stateful protocol and does not support restarting connection to server if it closed by server due timeout or restart. 3. svn+ssh also can be problem (stsp) 4. Currently serf library has a bug that serf_context_t need manual connection reset in case of error or cancellation during processing the request.
Despite of that idea of reusing ra session considered as step in right direction. It should also fix issue 3763 [1] (checkout should re-use ra session for externals if possible). Current my current plain is following: 1. Add function like svn_client_close_all_sessions() to close all cached ra sessions 2. Add new RA capability to signal if RA session is reusable and stateless. Enable it for ra_local and ra_serf. Leave ra_svn not capable for reusing sessions. 3. Commit this change and start switching code to explicitly returning sessions back to cache to reuse them. 4. Extend ra_svn implementation and protocol to support connection restart and cheap session reparent. Is it makes sense? [1] http://subversion.tigris.org/issues/show_bug.cgi?id=3763 -- Ivan Zhakov CTO | VisualSVN | http://www.visualsvn.com