c# - SharpSVN connection rate limit to localhost? -
c# - SharpSVN connection rate limit to localhost? -
we utilize sharpsvn programmatically access svn repositories. have problem access local repositories via svn:// or http:// urls slow - every access needs @ to the lowest degree 1 second, , our app needs fetch bunch of properties , directory listings.
we reproduce problem on 2 different machines, both windows 7 32 bit , in same domain. svn servers visualsvn 2.1.9 http:// urls , collabnet 1.6.17 svn:// urls. appears connections via "localhost" , via host name. appears in our c# application, little testbed app using ironpython , when calling sharpsvn svn.exe command.
this problem not happen when accessing when accessing remote repositories (both linux , windows xp server) - here, each access between 0.01 , 0.08 secs, expected due network latency. problem not happen when acessing local repositories via file:// urls or when accessing repositories via "native" svn command line tools collabnet.
now question is: has windows 7 or .net or sharpsvn built-in limit applies localhost connections?
(addition: found out limit applies when connecting via little c# test programme using system.net.sockets.tcpclient:
server:
using system; using system.io; using system.net; using system.net.sockets; namespace tcpspeedserver { class programme { public static void main() { int32 port = 47011; ipaddress localaddr = ipaddress.parse("127.0.0.1"); var server = new tcplistener(localaddr, port); server.start(); console.writeline("listening on {0} : {1}", localaddr, port); ulong count = 0; // come in listening loop. while(true) { using (var client = server.accepttcpclient()) { console.writeline("connected: {0} {1}!", count, client.client.remoteendpoint); count += 1; using (var stream = client.getstream()) { using (streamwriter author = new streamwriter(stream)) using (streamreader reader = new streamreader(stream)) { string query = reader.readline(); writer.writeline("get / http/1.0"); writer.writeline(); writer.flush(); } } } } } } }
client:
using system; using system.collections.generic; using system.io; using system.net.sockets; using system.threading; namespace tcpspeedtest { class programme { const bool async = false; static datetime s_now; public static void main(string[] args) { var liste = new list<object>(); s_now = datetime.now; (int i=0; < 100; += 1) { if (async) threadpool.queueuserworkitem(connect, i); else connect(i); } console.writeline("outer: " + (datetime.now - s_now)); console.readline(); } private static void connect(object i) { datetime = datetime.now; using (tcpclient client = new tcpclient("localhost", 47011)) { var stream = client.getstream(); using (streamwriter author = new streamwriter(stream)) using (streamreader reader = new streamreader(stream)) { writer.writeline("get / http/1.0"); writer.writeline(); writer.flush(); string result = reader.readline(); } } console.writeline(string.format("inner: {0} - {1} - {2}", i, datetime.now - now, datetime.now - s_now)); } } }
so problem seems not subversion specific.)
addition2: when running client under mono 2.10 windows, problem not appear. seems specific .net framework.
addition3: seems ipv6 related problem. server listens on ipv4, hostname resolves ipv6. seems os code internally tries ipv6 connection, , after getting connection reset, waits 1 sec before falling ipv4. , game repeated every single connection attempt. http://msdn.microsoft.com/en-us/library/115ytk56.aspx documents tcpclient (thanks andreas johansson msdn forums hint!), , seems apr used apache internally uses similar mechanism.
addition 3 solution problem. prepare this, either create dns/hosts file resolve ipv4 address, or create ipv6 server(s) work.
you can come in in c:\windows\system32\drivers\etc\hosts
like:
127.0.0.1 localhost-ipv4
and utilize name connect.
you can create svnserve hear ipv6 addresses. quick search svnserve options [revealed][1] defaults ipv6, in startup parameters --listen-host
. seek removing that, or when it's not nowadays forcing run @ ipv6.
the same can done apache webserver:
listen 0.0.0.0:80 hear [::]:80
c# .net svn connection sharpsvn
Comments
Post a Comment