コード例 #1
0
 public ElasticsearchManager(ElasticsearchRuntimeConfig config, WebArtifact artifact, string archiveRoot, string installRoot, string logRoot)
     : base(artifact, archiveRoot, logRoot)
 {
     _installRoot = installRoot;
     _elasticRoot = Path.Combine(installRoot, Path.GetFileNameWithoutExtension(artifact.Name));
     _pluginRoot  = Path.Combine(_elasticRoot, ELASTICSEARCH_PLUGIN_DIR);
     _config      = config;
 }
コード例 #2
0
        public ElasticsearchRuntimeConfig()
        {
            MEMORYSTATUSEX memoryStatus = new MEMORYSTATUSEX();

            ElasticsearchRuntimeConfig.GlobalMemoryStatusEx(memoryStatus);

            var totalPhycialBytesInMB = memoryStatus.ullTotalPhys / 1024L / 1024L;

            _ES_HEAP_SIZE = Convert.ToInt32(totalPhycialBytesInMB / 2);

            if (_ES_HEAP_SIZE == 0)
            {
                Trace.TraceWarning("Unable to calculate ES_HEAP_SIZE based on available memory");
            }
            else
            {
                Trace.TraceInformation("Calculated ES_HEAP_SIZE is {0}MB based on physical memory of {0}MB", _ES_HEAP_SIZE, totalPhycialBytesInMB);
            }
        }