From f8a4b61954707a0adb7a20f7a1b530631c15aa79 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 30 Sep 2012 15:49:51 +0100 Subject: Allow up to 12 simultaneous connections to a given endpoint rather than 2 --- OpenSim/Region/Application/Application.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index ebfebc4..a5a5201 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -73,6 +73,7 @@ namespace OpenSim AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + ServicePointManager.DefaultConnectionLimit = 12; // Add the arguments supplied when running the application to the configuration ArgvConfigSource configSource = new ArgvConfigSource(args); -- cgit v1.1 From 7cc89cdadccd743a4c1ad8a7f16e896842d849e6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 30 Sep 2012 15:57:49 +0100 Subject: Add using clause I missed --- OpenSim/Region/Application/Application.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index a5a5201..0f90d37 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -27,6 +27,7 @@ using System; using System.IO; +using System.Net; using System.Reflection; using log4net; using log4net.Config; -- cgit v1.1 From 060d6fe8f4eba0c1b1c0cb4f52acd2fd59725c66 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:11:23 +0200 Subject: Allow setting max connections for an endpoint --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ff57422..d5bc3c3 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -648,7 +648,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; - if (tickdiff > 3000) + if (tickdiff > 3000 && requestHandler.Name != "GetTexture") { m_log.InfoFormat( "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index e4c3eaf..086b5ad 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -108,7 +108,7 @@ namespace OpenSim.Services.Connectors if (asset == null) { asset = SynchronousRestObjectRequester. - MakeRequest("GET", uri, 0); + MakeRequest("GET", uri, 0, 30); if (m_Cache != null) m_Cache.Cache(asset); @@ -221,7 +221,7 @@ namespace OpenSim.Services.Connectors m_AssetHandlers.Remove(id); } handlers.Invoke(a); - }); + }, 30); success = true; } @@ -326,4 +326,4 @@ namespace OpenSim.Services.Connectors return false; } } -} \ No newline at end of file +} -- cgit v1.1 From 503ce70f74bc59813fc662373aabccc0b3962b05 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Sep 2012 00:15:10 +0200 Subject: Allow setting connection limits, part 2 --- OpenSim/Framework/WebUtil.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1d9e2ce..5c34cf4 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -717,6 +717,13 @@ namespace OpenSim.Framework public static void MakeRequest(string verb, string requestUrl, TRequest obj, Action action) { + MakeRequest(verb, requestUrl, obj, action, 0); + } + + public static void MakeRequest(string verb, + string requestUrl, TRequest obj, Action action, + int maxConnections) + { int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) @@ -730,6 +737,10 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -1036,6 +1047,16 @@ namespace OpenSim.Framework /// the request. You'll want to make sure you deal with this as they're not uncommon public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { + return MakeRequest(verb, requestUrl, obj, 0); + } + + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout) + { + return MakeRequest(verb, requestUrl, obj, pTimeout, 0); + } + + public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) + { int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) @@ -1050,6 +1071,10 @@ namespace OpenSim.Framework TResponse deserial = default(TResponse); WebRequest request = WebRequest.Create(requestUrl); + HttpWebRequest ht = (HttpWebRequest)request; + if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) + ht.ServicePoint.ConnectionLimit = maxConnections; + request.Method = verb; MemoryStream buffer = null; @@ -1172,4 +1197,4 @@ namespace OpenSim.Framework return deserial; } } -} \ No newline at end of file +} -- cgit v1.1