aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/Application.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/Application.cs')
-rw-r--r--OpenSim/Region/Application/Application.cs43
1 files changed, 29 insertions, 14 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index c3e7ec2..6215055 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -75,6 +75,7 @@ namespace OpenSim
75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
76 76
77 ServicePointManager.DefaultConnectionLimit = 12; 77 ServicePointManager.DefaultConnectionLimit = 12;
78 ServicePointManager.UseNagleAlgorithm = false;
78 79
79 // Add the arguments supplied when running the application to the configuration 80 // Add the arguments supplied when running the application to the configuration
80 ArgvConfigSource configSource = new ArgvConfigSource(args); 81 ArgvConfigSource configSource = new ArgvConfigSource(args);
@@ -103,48 +104,63 @@ namespace OpenSim
103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); 104 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
104 105
105 // Verify the Threadpool allocates or uses enough worker and IO completion threads 106 // Verify the Threadpool allocates or uses enough worker and IO completion threads
106 // .NET 2.0 workerthreads default to 50 * numcores 107 // .NET 2.0, workerthreads default to 50 * numcores
107 // .NET 3.0 workerthreads defaults to 250 * numcores 108 // .NET 3.0, workerthreads defaults to 250 * numcores
108 // .NET 4.0 workerthreads are dynamic based on bitness and OS resources 109 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources
109 // Max IO Completion threads are 1000 on all 3 CLRs. 110 // Max IO Completion threads are 1000 on all 3 CLRs
111 //
112 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
110 int workerThreadsMin = 500; 113 int workerThreadsMin = 500;
111 int workerThreadsMax = 1000; // may need further adjustment to match other CLR 114 int workerThreadsMax = 1000; // may need further adjustment to match other CLR
112 int iocpThreadsMin = 1000; 115 int iocpThreadsMin = 1000;
113 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR 116 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
117
118 {
119 int currentMinWorkerThreads, currentMinIocpThreads;
120 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads);
121 m_log.InfoFormat(
122 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads",
123 currentMinWorkerThreads, currentMinIocpThreads);
124 }
125
114 int workerThreads, iocpThreads; 126 int workerThreads, iocpThreads;
115 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); 127 System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
116 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads); 128 m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} max worker threads and {1} max IOCP threads", workerThreads, iocpThreads);
129
117 if (workerThreads < workerThreadsMin) 130 if (workerThreads < workerThreadsMin)
118 { 131 {
119 workerThreads = workerThreadsMin; 132 workerThreads = workerThreadsMin;
120 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to worker threads to {0}",workerThreads); 133 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to max worker threads to {0}",workerThreads);
121 } 134 }
122 if (workerThreads > workerThreadsMax) 135 if (workerThreads > workerThreadsMax)
123 { 136 {
124 workerThreads = workerThreadsMax; 137 workerThreads = workerThreadsMax;
125 m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); 138 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
126 } 139 }
140
127 // Increase the number of IOCP threads available. 141 // Increase the number of IOCP threads available.
128 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) 142 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
129 if (iocpThreads < iocpThreadsMin) 143 if (iocpThreads < iocpThreadsMin)
130 { 144 {
131 iocpThreads = iocpThreadsMin; 145 iocpThreads = iocpThreadsMin;
132 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads); 146 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads);
133 } 147 }
134 // Make sure we don't overallocate IOCP threads and thrash system resources 148 // Make sure we don't overallocate IOCP threads and thrash system resources
135 if ( iocpThreads > iocpThreadsMax ) 149 if ( iocpThreads > iocpThreadsMax )
136 { 150 {
137 iocpThreads = iocpThreadsMax; 151 iocpThreads = iocpThreadsMax;
138 m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads); 152 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads);
139 } 153 }
140 // set the resulting worker and IO completion thread counts back to ThreadPool 154 // set the resulting worker and IO completion thread counts back to ThreadPool
141 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) 155 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
142 { 156 {
143 m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads); 157 m_log.InfoFormat(
158 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads",
159 workerThreads, iocpThreads);
144 } 160 }
145 else 161 else
146 { 162 {
147 m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); 163 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
148 } 164 }
149 165
150 // Check if the system is compatible with OpenSimulator. 166 // Check if the system is compatible with OpenSimulator.
@@ -152,17 +168,16 @@ namespace OpenSim
152 string supported = String.Empty; 168 string supported = String.Empty;
153 if (Util.IsEnvironmentSupported(ref supported)) 169 if (Util.IsEnvironmentSupported(ref supported))
154 { 170 {
155 m_log.Info("Environment is compatible.\n"); 171 m_log.Info("[OPENSIM MAIN]: Environment is supported by OpenSimulator.");
156 } 172 }
157 else 173 else
158 { 174 {
159 m_log.Warn("Environment is unsupported (" + supported + ")\n"); 175 m_log.Warn("[OPENSIM MAIN]: Environment is not supported by OpenSimulator (" + supported + ")\n");
160 } 176 }
161 177
162 // Configure nIni aliases and localles 178 // Configure nIni aliases and localles
163 Culture.SetCurrentCulture(); 179 Culture.SetCurrentCulture();
164 180
165
166 // Validate that the user has the most basic configuration done 181 // Validate that the user has the most basic configuration done
167 // If not, offer to do the most basic configuration for them warning them along the way of the importance of 182 // If not, offer to do the most basic configuration for them warning them along the way of the importance of
168 // reading these files. 183 // reading these files.