123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using Serilog;
- namespace Aip.Service;
- public class Startup
- {
- public static void SetSystemConfig()
- {
- ThreadPool.GetAvailableThreads(out int workerThreads1, out int completionPortThreads1);
- ThreadPool.GetMaxThreads(out int workerThreads2, out int completionPortThreads2);
- ThreadPool.GetMinThreads(out int workerThreads3, out int completionPortThreads3);
- Log.Information(" AvailableThreads: worker({0}), port({1})", workerThreads1, completionPortThreads1);
- Log.Information(" MaxThreads: worker({0}), port({1})", workerThreads2, completionPortThreads2);
- Log.Information(" MinThreads: worker({0}), port({1})", workerThreads3, completionPortThreads3);
- Log.Information(" UseNagleAlgorithm: {0}", System.Net.ServicePointManager.UseNagleAlgorithm);
- System.Net.ServicePointManager.UseNagleAlgorithm = false;
- Log.Information(" UseNagleAlgorithm: {0}, Application Set.", System.Net.ServicePointManager.UseNagleAlgorithm);
- Log.Information(" Expect100Continue: {0}", System.Net.ServicePointManager.Expect100Continue);
- System.Net.ServicePointManager.Expect100Continue = false;
- Log.Information(" Expect100Continue: {0}, Application Set.", System.Net.ServicePointManager.Expect100Continue);
- Log.Information(" CheckCertificateRevocationList: {0}", System.Net.ServicePointManager.CheckCertificateRevocationList);
- System.Net.ServicePointManager.CheckCertificateRevocationList = true;
- Log.Information(" CheckCertificateRevocationList: {0}, Application Set.", System.Net.ServicePointManager.CheckCertificateRevocationList);
- Log.Information("DefaultPersistentConnectionLimit: {0}", System.Net.ServicePointManager.DefaultPersistentConnectionLimit);
- Log.Information(" DefaultConnectionLimit: {0}", System.Net.ServicePointManager.DefaultConnectionLimit);
- System.Net.ServicePointManager.DefaultConnectionLimit = 2048;
- Log.Information(" DefaultConnectionLimit: {0}, Application Set.", System.Net.ServicePointManager.DefaultConnectionLimit);
- // Bump up the min threads reserved for this app to ramp connections faster - minWorkerThreads defaults to 4, minIOCP defaults to 4
- ThreadPool.SetMinThreads(100, 100);
- // Change max connections from .NET to a remote service default: 2
- //System.Net.ServicePointManager.DefaultConnectionLimit = 65000;
- // Turn off the Expect 100 to continue message - 'true' will cause the caller to wait until it round-trip confirms a connection to the server
- //System.Net.ServicePointManager.Expect100Continue = false;
- // Can decrease overall transmission overhead but can cause delay in data packet arrival
- //System.Net.ServicePointManager.UseNagleAlgorithm = false;
- }
- }
|