diff options
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 41 |
3 files changed, 86 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..a5b9443 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Linq; | ||
33 | using System.Reflection; | 34 | using System.Reflection; |
34 | using System.Text; | 35 | using System.Text; |
35 | using System.Text.RegularExpressions; | 36 | using System.Text.RegularExpressions; |
@@ -236,18 +237,6 @@ namespace OpenSim | |||
236 | + "If an avatar name is given then only packets from that avatar are logged", | 237 | + "If an avatar name is given then only packets from that avatar are logged", |
237 | Debug); | 238 | Debug); |
238 | 239 | ||
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", | 240 | m_console.Commands.AddCommand("General", false, "change region", |
252 | "change region <region name>", | 241 | "change region <region name>", |
253 | "Change current console region", ChangeSelectedRegion); | 242 | "Change current console region", ChangeSelectedRegion); |
@@ -744,31 +733,6 @@ namespace OpenSim | |||
744 | 733 | ||
745 | break; | 734 | break; |
746 | 735 | ||
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: | 736 | default: |
773 | MainConsole.Instance.Output("Unknown debug command"); | 737 | MainConsole.Instance.Output("Unknown debug command"); |
774 | break; | 738 | break; |
@@ -845,16 +809,28 @@ namespace OpenSim | |||
845 | break; | 809 | break; |
846 | 810 | ||
847 | case "modules": | 811 | case "modules": |
848 | SceneManager.ForEachScene( | 812 | SceneManager.ForEachSelectedScene( |
849 | delegate(Scene scene) { | 813 | scene => |
850 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
851 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
852 | { | 814 | { |
853 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 815 | MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); |
854 | string module_type = type != null ? "Shared" : "Non-Shared"; | 816 | |
855 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | 817 | List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>(); |
818 | List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>(); | ||
819 | |||
820 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
821 | { | ||
822 | if (module.GetType().GetInterface("ISharedRegionModule") != null) | ||
823 | nonSharedModules.Add(module); | ||
824 | else | ||
825 | sharedModules.Add(module); | ||
826 | } | ||
827 | |||
828 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
829 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | ||
830 | |||
831 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
832 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | ||
856 | } | 833 | } |
857 | } | ||
858 | ); | 834 | ); |
859 | 835 | ||
860 | MainConsole.Instance.Output(""); | 836 | MainConsole.Instance.Output(""); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index bed9a49..7497d88 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -138,6 +138,10 @@ namespace OpenSim | |||
138 | /// <param name="configSource"></param> | 138 | /// <param name="configSource"></param> |
139 | public OpenSimBase(IConfigSource configSource) : base() | 139 | public OpenSimBase(IConfigSource configSource) : base() |
140 | { | 140 | { |
141 | // FIXME: This should be done down in ServerBase but we need to sort out and refactor the log4net | ||
142 | // XmlConfigurator calls first accross servers. | ||
143 | m_log.InfoFormat("[SERVER BASE]: Starting in {0}", m_startupDirectory); | ||
144 | |||
141 | LoadConfigSettings(configSource); | 145 | LoadConfigSettings(configSource); |
142 | } | 146 | } |
143 | 147 | ||
@@ -331,7 +335,7 @@ namespace OpenSim | |||
331 | /// <param name="regionInfo"></param> | 335 | /// <param name="regionInfo"></param> |
332 | /// <param name="portadd_flag"></param> | 336 | /// <param name="portadd_flag"></param> |
333 | /// <returns></returns> | 337 | /// <returns></returns> |
334 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) | 338 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
335 | { | 339 | { |
336 | return CreateRegion(regionInfo, portadd_flag, false, out scene); | 340 | return CreateRegion(regionInfo, portadd_flag, false, out scene); |
337 | } | 341 | } |
@@ -341,7 +345,7 @@ namespace OpenSim | |||
341 | /// </summary> | 345 | /// </summary> |
342 | /// <param name="regionInfo"></param> | 346 | /// <param name="regionInfo"></param> |
343 | /// <returns></returns> | 347 | /// <returns></returns> |
344 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) | 348 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) |
345 | { | 349 | { |
346 | return CreateRegion(regionInfo, false, true, out scene); | 350 | return CreateRegion(regionInfo, false, true, out scene); |
347 | } | 351 | } |
@@ -353,7 +357,7 @@ namespace OpenSim | |||
353 | /// <param name="portadd_flag"></param> | 357 | /// <param name="portadd_flag"></param> |
354 | /// <param name="do_post_init"></param> | 358 | /// <param name="do_post_init"></param> |
355 | /// <returns></returns> | 359 | /// <returns></returns> |
356 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) | 360 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
357 | { | 361 | { |
358 | int port = regionInfo.InternalEndPoint.Port; | 362 | int port = regionInfo.InternalEndPoint.Port; |
359 | 363 | ||
@@ -378,8 +382,8 @@ namespace OpenSim | |||
378 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 382 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
379 | } | 383 | } |
380 | 384 | ||
381 | IClientNetworkServer clientServer; | 385 | List<IClientNetworkServer> clientServers; |
382 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); | 386 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); |
383 | 387 | ||
384 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 388 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
385 | 389 | ||
@@ -483,8 +487,11 @@ namespace OpenSim | |||
483 | 487 | ||
484 | if (m_autoCreateClientStack) | 488 | if (m_autoCreateClientStack) |
485 | { | 489 | { |
486 | m_clientServers.Add(clientServer); | 490 | foreach (IClientNetworkServer clientserver in clientServers) |
487 | clientServer.Start(); | 491 | { |
492 | m_clientServers.Add(clientserver); | ||
493 | clientserver.Start(); | ||
494 | } | ||
488 | } | 495 | } |
489 | 496 | ||
490 | if (scene.SnmpService != null) | 497 | if (scene.SnmpService != null) |
@@ -504,7 +511,7 @@ namespace OpenSim | |||
504 | scene.Start(); | 511 | scene.Start(); |
505 | scene.StartScripts(); | 512 | scene.StartScripts(); |
506 | 513 | ||
507 | return clientServer; | 514 | return clientServers; |
508 | } | 515 | } |
509 | 516 | ||
510 | /// <summary> | 517 | /// <summary> |
@@ -725,7 +732,7 @@ namespace OpenSim | |||
725 | /// <param name="regionInfo"></param> | 732 | /// <param name="regionInfo"></param> |
726 | /// <param name="clientServer"> </param> | 733 | /// <param name="clientServer"> </param> |
727 | /// <returns></returns> | 734 | /// <returns></returns> |
728 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | 735 | protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) |
729 | { | 736 | { |
730 | return SetupScene(regionInfo, 0, null, out clientServer); | 737 | return SetupScene(regionInfo, 0, null, out clientServer); |
731 | } | 738 | } |
@@ -739,8 +746,10 @@ namespace OpenSim | |||
739 | /// <param name="clientServer"> </param> | 746 | /// <param name="clientServer"> </param> |
740 | /// <returns></returns> | 747 | /// <returns></returns> |
741 | protected Scene SetupScene( | 748 | protected Scene SetupScene( |
742 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) | 749 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) |
743 | { | 750 | { |
751 | List<IClientNetworkServer> clientNetworkServers = null; | ||
752 | |||
744 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 753 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
745 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | 754 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; |
746 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | 755 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) |
@@ -750,8 +759,7 @@ namespace OpenSim | |||
750 | 759 | ||
751 | if (m_autoCreateClientStack) | 760 | if (m_autoCreateClientStack) |
752 | { | 761 | { |
753 | clientServer | 762 | clientNetworkServers = m_clientStackManager.CreateServers( |
754 | = m_clientStackManager.CreateServer( | ||
755 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | 763 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, |
756 | circuitManager); | 764 | circuitManager); |
757 | } | 765 | } |
@@ -766,9 +774,12 @@ namespace OpenSim | |||
766 | 774 | ||
767 | if (m_autoCreateClientStack) | 775 | if (m_autoCreateClientStack) |
768 | { | 776 | { |
769 | clientServer.AddScene(scene); | 777 | foreach (IClientNetworkServer clientnetserver in clientNetworkServers) |
778 | { | ||
779 | clientnetserver.AddScene(scene); | ||
780 | } | ||
770 | } | 781 | } |
771 | 782 | clientServer = clientNetworkServers; | |
772 | scene.LoadWorldMap(); | 783 | scene.LoadWorldMap(); |
773 | 784 | ||
774 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | 785 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); |
@@ -791,7 +802,7 @@ namespace OpenSim | |||
791 | 802 | ||
792 | return new Scene( | 803 | return new Scene( |
793 | regionInfo, circuitManager, sceneGridService, | 804 | regionInfo, circuitManager, sceneGridService, |
794 | simDataService, estateDataService, false, | 805 | simDataService, estateDataService, |
795 | Config, m_version); | 806 | Config, m_version); |
796 | } | 807 | } |
797 | 808 | ||