aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/Application.cs45
-rw-r--r--OpenSim/Region/Application/OpenSim.cs67
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs37
3 files changed, 83 insertions, 66 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 0f90d37..c3e7ec2 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -102,17 +102,50 @@ namespace OpenSim
102 m_log.InfoFormat( 102 m_log.InfoFormat(
103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); 103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
104 104
105 // Increase the number of IOCP threads available. Mono defaults to a tragically low number 105 // Verify the Threadpool allocates or uses enough worker and IO completion threads
106 // .NET 2.0 workerthreads default to 50 * numcores
107 // .NET 3.0 workerthreads defaults to 250 * numcores
108 // .NET 4.0 workerthreads are dynamic based on bitness and OS resources
109 // Max IO Completion threads are 1000 on all 3 CLRs.
110 int workerThreadsMin = 500;
111 int workerThreadsMax = 1000; // may need further adjustment to match other CLR
112 int iocpThreadsMin = 1000;
113 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
106 int workerThreads, iocpThreads; 114 int workerThreads, iocpThreads;
107 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); 115 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
108 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads); 116 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads);
109 if (workerThreads < 500 || iocpThreads < 1000) 117 if (workerThreads < workerThreadsMin)
110 { 118 {
111 workerThreads = 500; 119 workerThreads = workerThreadsMin;
112 iocpThreads = 1000; 120 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to worker threads to {0}",workerThreads);
113 m_log.Info("[OPENSIM MAIN]: Bumping up to 500 worker threads and 1000 IOCP threads");
114 System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads);
115 } 121 }
122 if (workerThreads > workerThreadsMax)
123 {
124 workerThreads = workerThreadsMax;
125 m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads);
126 }
127 // Increase the number of IOCP threads available.
128 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
129 if (iocpThreads < iocpThreadsMin)
130 {
131 iocpThreads = iocpThreadsMin;
132 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads);
133 }
134 // Make sure we don't overallocate IOCP threads and thrash system resources
135 if ( iocpThreads > iocpThreadsMax )
136 {
137 iocpThreads = iocpThreadsMax;
138 m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads);
139 }
140 // set the resulting worker and IO completion thread counts back to ThreadPool
141 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
142 {
143 m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads);
144 }
145 else
146 {
147 m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
148 }
116 149
117 // Check if the system is compatible with OpenSimulator. 150 // Check if the system is compatible with OpenSimulator.
118 // Ensures that the minimum system requirements are met 151 // Ensures that the minimum system requirements are met
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 08e4023..a7e7d03 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.IO; 32using System.IO;
33using System.Linq;
33using System.Reflection; 34using System.Reflection;
34using System.Text; 35using System.Text;
35using System.Text.RegularExpressions; 36using System.Text.RegularExpressions;
@@ -158,6 +159,7 @@ namespace OpenSim
158 159
159 MainConsole.Instance = m_console; 160 MainConsole.Instance = m_console;
160 161
162 LogEnvironmentInformation();
161 RegisterCommonAppenders(Config.Configs["Startup"]); 163 RegisterCommonAppenders(Config.Configs["Startup"]);
162 RegisterConsoleCommands(); 164 RegisterConsoleCommands();
163 165
@@ -236,18 +238,6 @@ namespace OpenSim
236 + "If an avatar name is given then only packets from that avatar are logged", 238 + "If an avatar name is given then only packets from that avatar are logged",
237 Debug); 239 Debug);
238 240
239 m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
240
241 m_console.Commands.AddCommand("Debug", false, "debug scene",
242 "debug scene active|collisions|physics|scripting|teleport true|false",
243 "Turn on scene debugging.",
244 "If active is false then main scene update and maintenance loops are suspended.\n"
245 + "If collisions is false then collisions with other objects are turned off.\n"
246 + "If physics is false then all physics objects are non-physical.\n"
247 + "If scripting is false then no scripting operations happen.\n"
248 + "If teleport is true then some extra teleport debug information is logged.",
249 Debug);
250
251 m_console.Commands.AddCommand("General", false, "change region", 241 m_console.Commands.AddCommand("General", false, "change region",
252 "change region <region name>", 242 "change region <region name>",
253 "Change current console region", ChangeSelectedRegion); 243 "Change current console region", ChangeSelectedRegion);
@@ -744,31 +734,6 @@ namespace OpenSim
744 734
745 break; 735 break;
746 736
747 case "scene":
748 if (args.Length == 4)
749 {
750 if (SceneManager.CurrentScene == null)
751 {
752 MainConsole.Instance.Output("Please use 'change region <regioname>' first");
753 }
754 else
755 {
756 string key = args[2];
757 string value = args[3];
758 SceneManager.CurrentScene.SetSceneCoreDebug(
759 new Dictionary<string, string>() { { key, value } });
760
761 MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
762 }
763 }
764 else
765 {
766 MainConsole.Instance.Output(
767 "Usage: debug scene active|scripting|collisions|physics|teleport true|false");
768 }
769
770 break;
771
772 default: 737 default:
773 MainConsole.Instance.Output("Unknown debug command"); 738 MainConsole.Instance.Output("Unknown debug command");
774 break; 739 break;
@@ -845,16 +810,28 @@ namespace OpenSim
845 break; 810 break;
846 811
847 case "modules": 812 case "modules":
848 SceneManager.ForEachScene( 813 SceneManager.ForEachSelectedScene(
849 delegate(Scene scene) { 814 scene =>
850 MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:");
851 foreach (IRegionModuleBase module in scene.RegionModules.Values)
852 { 815 {
853 Type type = module.GetType().GetInterface("ISharedRegionModule"); 816 MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name);
854 string module_type = type != null ? "Shared" : "Non-Shared"; 817
855 MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); 818 List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>();
819 List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>();
820
821 foreach (IRegionModuleBase module in scene.RegionModules.Values)
822 {
823 if (module.GetType().GetInterface("ISharedRegionModule") != null)
824 nonSharedModules.Add(module);
825 else
826 sharedModules.Add(module);
827 }
828
829 foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
830 MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name);
831
832 foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
833 MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name);
856 } 834 }
857 }
858 ); 835 );
859 836
860 MainConsole.Instance.Output(""); 837 MainConsole.Instance.Output("");
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index bed9a49..7361f50 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -331,7 +331,7 @@ namespace OpenSim
331 /// <param name="regionInfo"></param> 331 /// <param name="regionInfo"></param>
332 /// <param name="portadd_flag"></param> 332 /// <param name="portadd_flag"></param>
333 /// <returns></returns> 333 /// <returns></returns>
334 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) 334 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene)
335 { 335 {
336 return CreateRegion(regionInfo, portadd_flag, false, out scene); 336 return CreateRegion(regionInfo, portadd_flag, false, out scene);
337 } 337 }
@@ -341,7 +341,7 @@ namespace OpenSim
341 /// </summary> 341 /// </summary>
342 /// <param name="regionInfo"></param> 342 /// <param name="regionInfo"></param>
343 /// <returns></returns> 343 /// <returns></returns>
344 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) 344 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene)
345 { 345 {
346 return CreateRegion(regionInfo, false, true, out scene); 346 return CreateRegion(regionInfo, false, true, out scene);
347 } 347 }
@@ -353,7 +353,7 @@ namespace OpenSim
353 /// <param name="portadd_flag"></param> 353 /// <param name="portadd_flag"></param>
354 /// <param name="do_post_init"></param> 354 /// <param name="do_post_init"></param>
355 /// <returns></returns> 355 /// <returns></returns>
356 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) 356 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
357 { 357 {
358 int port = regionInfo.InternalEndPoint.Port; 358 int port = regionInfo.InternalEndPoint.Port;
359 359
@@ -378,8 +378,8 @@ namespace OpenSim
378 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); 378 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
379 } 379 }
380 380
381 IClientNetworkServer clientServer; 381 List<IClientNetworkServer> clientServers;
382 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); 382 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers);
383 383
384 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 384 m_log.Info("[MODULES]: Loading Region's modules (old style)");
385 385
@@ -483,8 +483,11 @@ namespace OpenSim
483 483
484 if (m_autoCreateClientStack) 484 if (m_autoCreateClientStack)
485 { 485 {
486 m_clientServers.Add(clientServer); 486 foreach (IClientNetworkServer clientserver in clientServers)
487 clientServer.Start(); 487 {
488 m_clientServers.Add(clientserver);
489 clientserver.Start();
490 }
488 } 491 }
489 492
490 if (scene.SnmpService != null) 493 if (scene.SnmpService != null)
@@ -504,7 +507,7 @@ namespace OpenSim
504 scene.Start(); 507 scene.Start();
505 scene.StartScripts(); 508 scene.StartScripts();
506 509
507 return clientServer; 510 return clientServers;
508 } 511 }
509 512
510 /// <summary> 513 /// <summary>
@@ -725,7 +728,7 @@ namespace OpenSim
725 /// <param name="regionInfo"></param> 728 /// <param name="regionInfo"></param>
726 /// <param name="clientServer"> </param> 729 /// <param name="clientServer"> </param>
727 /// <returns></returns> 730 /// <returns></returns>
728 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) 731 protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer)
729 { 732 {
730 return SetupScene(regionInfo, 0, null, out clientServer); 733 return SetupScene(regionInfo, 0, null, out clientServer);
731 } 734 }
@@ -739,8 +742,10 @@ namespace OpenSim
739 /// <param name="clientServer"> </param> 742 /// <param name="clientServer"> </param>
740 /// <returns></returns> 743 /// <returns></returns>
741 protected Scene SetupScene( 744 protected Scene SetupScene(
742 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) 745 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer)
743 { 746 {
747 List<IClientNetworkServer> clientNetworkServers = null;
748
744 AgentCircuitManager circuitManager = new AgentCircuitManager(); 749 AgentCircuitManager circuitManager = new AgentCircuitManager();
745 IPAddress listenIP = regionInfo.InternalEndPoint.Address; 750 IPAddress listenIP = regionInfo.InternalEndPoint.Address;
746 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) 751 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
@@ -750,8 +755,7 @@ namespace OpenSim
750 755
751 if (m_autoCreateClientStack) 756 if (m_autoCreateClientStack)
752 { 757 {
753 clientServer 758 clientNetworkServers = m_clientStackManager.CreateServers(
754 = m_clientStackManager.CreateServer(
755 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, 759 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
756 circuitManager); 760 circuitManager);
757 } 761 }
@@ -766,9 +770,12 @@ namespace OpenSim
766 770
767 if (m_autoCreateClientStack) 771 if (m_autoCreateClientStack)
768 { 772 {
769 clientServer.AddScene(scene); 773 foreach (IClientNetworkServer clientnetserver in clientNetworkServers)
774 {
775 clientnetserver.AddScene(scene);
776 }
770 } 777 }
771 778 clientServer = clientNetworkServers;
772 scene.LoadWorldMap(); 779 scene.LoadWorldMap();
773 780
774 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); 781 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
@@ -791,7 +798,7 @@ namespace OpenSim
791 798
792 return new Scene( 799 return new Scene(
793 regionInfo, circuitManager, sceneGridService, 800 regionInfo, circuitManager, sceneGridService,
794 simDataService, estateDataService, false, 801 simDataService, estateDataService,
795 Config, m_version); 802 Config, m_version);
796 } 803 }
797 804