> -----Original Message----- > From: Ivan Zhakov [mailto:i...@visualsvn.com] > Sent: dinsdag 11 juni 2013 15:22 > To: Subversion Development > Subject: [RFC, PATCH] RA context abstraction layer in libsvn_client > > 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. > > [[[ > Introduce repository access abstraction layer for managing RA session for > different repositories. > > * subversion/include/private/svn_client_private.h > (svn_client__ra_session_release): New. > (svn_client__ra_session_from_path2): Document that created session will > be > automatically returned back to RA session cache on pool cleanup. > > * subversion/libsvn_client/ra.c > (): Include ra_ctx.h. > (svn_client__open_ra_session_internal): Use > svn_client__ra_session_open(). > (svn_client__ra_session_release): New. Wrapper around > svn_client__ra_ctx_release_session() > > * subversion/include/svn_client.h > (svn_client_ctx_t): Add RA_CTX member. > > * subversion/libsvn_client/ctx.c > (): Include ra_ctx.h. > (svn_client_create_context2): Initialize RA_CTX.
I haven't looked at the code yet, but is this going to work for clients that keep a svn_client_context_t instance for hours/days/weeks? All that time reusing it for different operations every now and then. (One step further: How would this be affected by configuration and/or authorization baton changes when there are sessions cached) Existing TCP connections (w/c)ould be broken on the next usage, kerberos cookies could have expired, etc. etc., especially with ra_svn, but maybe also with ra_serf where an existing connection can be reused in some cases. > > * subversion/libsvn_client/log.c > (svn_client_log5): Return RA session back to session cache. > > * subversion/libsvn_client/ra_ctx.c > * subversion/libsvn_client/ra_ctx.h > (svn_client__ra_ctx_t, svn_client__ra_ctx_create, > svn_client__ra_session_open, svn_client__ra_ctx_release_session): New. > ]]] Bert > > -- > Ivan Zhakov > CTO | VisualSVN | http://www.visualsvn.com