aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/Application.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/Application/Application.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/Application/Application.cs')
-rw-r--r--OpenSim/Region/Application/Application.cs69
1 files changed, 39 insertions, 30 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index bf34419..66ce8e5 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -74,7 +74,16 @@ namespace OpenSim
74 AppDomain.CurrentDomain.UnhandledException += 74 AppDomain.CurrentDomain.UnhandledException +=
75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
76 76
77 ServicePointManager.DefaultConnectionLimit = 12; 77 if(Util.IsWindows())
78 ServicePointManager.DefaultConnectionLimit = 32;
79 else
80 {
81 ServicePointManager.DefaultConnectionLimit = 12;
82 }
83
84 try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
85 ServicePointManager.Expect100Continue = false;
86 ServicePointManager.UseNagleAlgorithm = false;
78 87
79 // Add the arguments supplied when running the application to the configuration 88 // Add the arguments supplied when running the application to the configuration
80 ArgvConfigSource configSource = new ArgvConfigSource(args); 89 ArgvConfigSource configSource = new ArgvConfigSource(args);
@@ -85,9 +94,9 @@ namespace OpenSim
85 if (logConfigFile != String.Empty) 94 if (logConfigFile != String.Empty)
86 { 95 {
87 XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile)); 96 XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile));
88 m_log.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file", 97 m_log.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file",
89 logConfigFile); 98 logConfigFile);
90 } 99 }
91 else 100 else
92 { 101 {
93 XmlConfigurator.Configure(); 102 XmlConfigurator.Configure();
@@ -103,22 +112,22 @@ namespace OpenSim
103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); 112 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
104 113
105 // Verify the Threadpool allocates or uses enough worker and IO completion threads 114 // Verify the Threadpool allocates or uses enough worker and IO completion threads
106 // .NET 2.0, workerthreads default to 50 * numcores 115 // .NET 2.0, workerthreads default to 50 * numcores
107 // .NET 3.0, workerthreads defaults to 250 * numcores 116 // .NET 3.0, workerthreads defaults to 250 * numcores
108 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources 117 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources
109 // Max IO Completion threads are 1000 on all 3 CLRs 118 // Max IO Completion threads are 1000 on all 3 CLRs
110 // 119 //
111 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores 120 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
112 int workerThreadsMin = 500; 121 int workerThreadsMin = 500;
113 int workerThreadsMax = 1000; // may need further adjustment to match other CLR 122 int workerThreadsMax = 1000; // may need further adjustment to match other CLR
114 int iocpThreadsMin = 1000; 123 int iocpThreadsMin = 1000;
115 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR 124 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
116 125
117 { 126 {
118 int currentMinWorkerThreads, currentMinIocpThreads; 127 int currentMinWorkerThreads, currentMinIocpThreads;
119 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); 128 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads);
120 m_log.InfoFormat( 129 m_log.InfoFormat(
121 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", 130 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads",
122 currentMinWorkerThreads, currentMinIocpThreads); 131 currentMinWorkerThreads, currentMinIocpThreads);
123 } 132 }
124 133
@@ -137,30 +146,30 @@ namespace OpenSim
137 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads); 146 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
138 } 147 }
139 148
140 // Increase the number of IOCP threads available. 149 // Increase the number of IOCP threads available.
141 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) 150 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
142 if (iocpThreads < iocpThreadsMin) 151 if (iocpThreads < iocpThreadsMin)
143 { 152 {
144 iocpThreads = iocpThreadsMin; 153 iocpThreads = iocpThreadsMin;
145 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads); 154 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads);
146 } 155 }
147 // Make sure we don't overallocate IOCP threads and thrash system resources 156 // Make sure we don't overallocate IOCP threads and thrash system resources
148 if ( iocpThreads > iocpThreadsMax ) 157 if ( iocpThreads > iocpThreadsMax )
149 { 158 {
150 iocpThreads = iocpThreadsMax; 159 iocpThreads = iocpThreadsMax;
151 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads); 160 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads);
152 } 161 }
153 // set the resulting worker and IO completion thread counts back to ThreadPool 162 // set the resulting worker and IO completion thread counts back to ThreadPool
154 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) 163 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
155 { 164 {
156 m_log.InfoFormat( 165 m_log.InfoFormat(
157 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads", 166 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads",
158 workerThreads, iocpThreads); 167 workerThreads, iocpThreads);
159 } 168 }
160 else 169 else
161 { 170 {
162 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); 171 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
163 } 172 }
164 173
165 // Check if the system is compatible with OpenSimulator. 174 // Check if the system is compatible with OpenSimulator.
166 // Ensures that the minimum system requirements are met 175 // Ensures that the minimum system requirements are met
@@ -178,7 +187,7 @@ namespace OpenSim
178 Culture.SetCurrentCulture(); 187 Culture.SetCurrentCulture();
179 188
180 // Validate that the user has the most basic configuration done 189 // Validate that the user has the most basic configuration done
181 // If not, offer to do the most basic configuration for them warning them along the way of the importance of 190 // If not, offer to do the most basic configuration for them warning them along the way of the importance of
182 // reading these files. 191 // reading these files.
183 /* 192 /*
184 m_log.Info("Checking for reguired configuration...\n"); 193 m_log.Info("Checking for reguired configuration...\n");
@@ -187,13 +196,13 @@ namespace OpenSim
187 || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini"))) 196 || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini")))
188 || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini"))) 197 || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini")))
189 || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini"))); 198 || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini")));
190 199
191 bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini")); 200 bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
192 bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini")); 201 bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini"));
193 bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini")); 202 bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini"));
194 bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini")); 203 bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini"));
195 204
196 if ((OpenSim_Ini) 205 if ((OpenSim_Ini)
197 && ( 206 && (
198 (StanaloneCommon_ProperCased 207 (StanaloneCommon_ProperCased
199 || StanaloneCommon_lowercased 208 || StanaloneCommon_lowercased
@@ -211,7 +220,7 @@ namespace OpenSim
211 "yes"); 220 "yes");
212 if (resp == "yes") 221 if (resp == "yes")
213 { 222 {
214 223
215 if (!(OpenSim_Ini)) 224 if (!(OpenSim_Ini))
216 { 225 {
217 try 226 try
@@ -311,7 +320,7 @@ namespace OpenSim
311 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); 320 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
312 321
313 // load Crash directory config 322 // load Crash directory config
314 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 323 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
315 324
316 if (background) 325 if (background)
317 { 326 {
@@ -319,9 +328,9 @@ namespace OpenSim
319 m_sim.Startup(); 328 m_sim.Startup();
320 } 329 }
321 else 330 else
322 { 331 {
323 m_sim = new OpenSim(configSource); 332 m_sim = new OpenSim(configSource);
324 333
325 m_sim.Startup(); 334 m_sim.Startup();
326 335
327 while (true) 336 while (true)