コード例 #1
0
ファイル: HostEnvironment.cs プロジェクト: melnx/Bermuda
        public void Initialize(IHostEnvironmentConfiguration hostEnvConfig)
        {
            ServicePointManager.DefaultConnectionLimit = 1000;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.UseNagleAlgorithm      = false;

            this.HostEnvironmentConfiguration = hostEnvConfig;
            this.StartInternalService(hostEnvConfig.InternalServiceEndPoint);
            this.StartExternalService(hostEnvConfig.ExternalServiceEndPoint);

            int bucket_count = BUCKET_COUNT;

#if DEBUG
            Thread.Sleep(2000);
            bucket_count = BUCKET_COUNT_DEBUG;
#else
            Thread.Sleep(10000);
#endif

            //ComputeNodeType NodeType = ComputeNodeType.MX;
            //switch (NodeType)
            //{
            //    case ComputeNodeType.MX:
            //        computeNode = new ComputeNodeMX.ComputeNodeMX(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new DatabaseSaturator.DatabaseSaturator(computeNode));
            //        processors.Add(new PurgeProcessor(computeNode));
            //        break;
            //    case ComputeNodeType.WeatherData:
            //        //Weather data compute node
            //        computeNode = new ComputeNodeWX.ComputeNodeWX(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new FileSaturator.FileSaturator(computeNode));
            //        break;
            //    case ComputeNodeType.WikiData:
            //        //Wikipedia data compute node
            //        computeNode = new ComputeNodeWikiData.ComputeNodeWikiData(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new S3Saturator.S3Saturator(computeNode));
            //        break;
            //}

            //string json = computeNode.SerializeComputeNode();
            //IComputeNode temp = computeNode.DeserializeComputeNode(json);
            //File.WriteAllText("c:\\temp\\BermudaMX.Config", json);

            computeNode = this.HostEnvironmentConfiguration.GetComputeNode();
            processors.AddRange(this.HostEnvironmentConfiguration.GetProcessors(computeNode));
            processors.ForEach(p => p.StartProcessor());
        }
コード例 #2
0
ファイル: HostEnvironment.cs プロジェクト: yonglehou/Bermuda
        public void Initialize(IHostEnvironmentConfiguration hostEnvConfig)
        {
            ServicePointManager.DefaultConnectionLimit = 1000;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.UseNagleAlgorithm = false;

            this.HostEnvironmentConfiguration = hostEnvConfig;
            this.StartInternalService(hostEnvConfig.InternalServiceEndPoint);
            this.StartExternalService(hostEnvConfig.ExternalServiceEndPoint);

            int bucket_count = BUCKET_COUNT;

#if DEBUG
            Thread.Sleep(2000);
            bucket_count = BUCKET_COUNT_DEBUG;
#else
            Thread.Sleep(10000);
#endif

            //ComputeNodeType NodeType = ComputeNodeType.MX;
            //switch (NodeType)
            //{
            //    case ComputeNodeType.MX:
            //        computeNode = new ComputeNodeMX.ComputeNodeMX(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new DatabaseSaturator.DatabaseSaturator(computeNode));
            //        processors.Add(new PurgeProcessor(computeNode));
            //        break;
            //    case ComputeNodeType.WeatherData:
            //        //Weather data compute node
            //        computeNode = new ComputeNodeWX.ComputeNodeWX(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new FileSaturator.FileSaturator(computeNode));
            //        break;
            //    case ComputeNodeType.WikiData:
            //        //Wikipedia data compute node
            //        computeNode = new ComputeNodeWikiData.ComputeNodeWikiData(this.HostEnvironmentConfiguration.CurrentInstanceIndex, bucket_count, this.HostEnvironmentConfiguration.AllNodeEndpoints.Count());
            //        computeNode.MinAvailableMemoryPercent = 20;
            //        computeNode.MaxAvailableMemoryPercent = 30;
            //        processors.Add(new S3Saturator.S3Saturator(computeNode));
            //        break;
            //}

            //string json = computeNode.SerializeComputeNode();
            //IComputeNode temp = computeNode.DeserializeComputeNode(json);
            //File.WriteAllText("c:\\temp\\BermudaMX.Config", json);

            computeNode = this.HostEnvironmentConfiguration.GetComputeNode();
            processors.AddRange(this.HostEnvironmentConfiguration.GetProcessors(computeNode));
            processors.ForEach(p => p.StartProcessor());
        }