webrequests serialiazation per endpoint its now ServicePointManager job
parent
91caf98308
commit
e5bebe3a32
|
@ -274,18 +274,6 @@ namespace OpenSim.Framework.Servers
|
|||
"Show thread status. Synonym for \"show threads\"",
|
||||
(string module, string[] args) => Notice(GetThreadsReport()));
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug comms set",
|
||||
"debug comms set serialosdreq true|false",
|
||||
"Set comms parameters. For debug purposes.",
|
||||
HandleDebugCommsSet);
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug comms status",
|
||||
"debug comms status",
|
||||
"Show current debug comms parameters.",
|
||||
HandleDebugCommsStatus);
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug threadpool set",
|
||||
"debug threadpool set worker|iocp min|max <n>",
|
||||
|
@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
public void RegisterCommonComponents(IConfigSource configSource)
|
||||
{
|
||||
IConfig networkConfig = configSource.Configs["Network"];
|
||||
|
||||
if (networkConfig != null)
|
||||
{
|
||||
WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
|
||||
}
|
||||
// IConfig networkConfig = configSource.Configs["Network"];
|
||||
|
||||
m_serverStatsCollector = new ServerStatsCollector();
|
||||
m_serverStatsCollector.Initialise(configSource);
|
||||
m_serverStatsCollector.Start();
|
||||
}
|
||||
|
||||
private void HandleDebugCommsStatus(string module, string[] args)
|
||||
{
|
||||
Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint);
|
||||
}
|
||||
|
||||
private void HandleDebugCommsSet(string module, string[] args)
|
||||
{
|
||||
if (args.Length != 5)
|
||||
{
|
||||
Notice("Usage: debug comms set serialosdreq true|false");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[3] != "serialosdreq")
|
||||
{
|
||||
Notice("Usage: debug comms set serialosdreq true|false");
|
||||
return;
|
||||
}
|
||||
|
||||
bool setSerializeOsdRequests;
|
||||
|
||||
if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests))
|
||||
return;
|
||||
|
||||
WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests;
|
||||
|
||||
Notice("serialosdreq is now {0}", setSerializeOsdRequests);
|
||||
}
|
||||
|
||||
private void HandleShowThreadpoolCallsActive(string module, string[] args)
|
||||
{
|
||||
List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList();
|
||||
|
|
|
@ -71,11 +71,6 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public static int RequestNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Control where OSD requests should be serialized per endpoint.
|
||||
/// </summary>
|
||||
public static bool SerializeOSDRequestsPerEndpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// this is the header field used to communicate the local request id
|
||||
/// used for performance and debugging
|
||||
|
@ -98,31 +93,6 @@ namespace OpenSim.Framework
|
|||
/// </remarks>
|
||||
public const int MaxRequestDiagLength = 200;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of end points
|
||||
/// </summary>
|
||||
private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>();
|
||||
|
||||
private static object EndPointLock(string url)
|
||||
{
|
||||
System.Uri uri = new System.Uri(url);
|
||||
string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port);
|
||||
|
||||
lock (m_endpointSerializer)
|
||||
{
|
||||
object eplock = null;
|
||||
|
||||
if (! m_endpointSerializer.TryGetValue(endpoint,out eplock))
|
||||
{
|
||||
eplock = new object();
|
||||
m_endpointSerializer.Add(endpoint,eplock);
|
||||
// m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
|
||||
}
|
||||
|
||||
return eplock;
|
||||
}
|
||||
}
|
||||
|
||||
#region JSONRequest
|
||||
|
||||
/// <summary>
|
||||
|
@ -154,21 +124,6 @@ namespace OpenSim.Framework
|
|||
return ServiceOSDRequest(url, null, "GET", timeout, false, false);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
{
|
||||
if (SerializeOSDRequestsPerEndpoint)
|
||||
{
|
||||
lock (EndPointLock(url))
|
||||
{
|
||||
return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LogOutgoingDetail(Stream outputStream)
|
||||
{
|
||||
LogOutgoingDetail("", outputStream);
|
||||
|
@ -222,7 +177,7 @@ namespace OpenSim.Framework
|
|||
LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input);
|
||||
}
|
||||
|
||||
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
|
||||
|
@ -421,14 +376,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
lock (EndPointLock(url))
|
||||
{
|
||||
return ServiceFormRequestWorker(url,data,timeout);
|
||||
}
|
||||
}
|
||||
|
||||
private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||
|
|
Loading…
Reference in New Issue