示例#1
0
        /// <summary>
        /// Sets a TimeSpan-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, TimeSpan Value)
        {
            await synchObject.BeginWrite();

            try
            {
                TimeSpanSetting Setting = await Database.FindFirstDeleteRest <TimeSpanSetting>(new FilterFieldEqualTo("Key", Key));

                if (Setting is null)
                {
                    Setting = new TimeSpanSetting(Key, Value);
                    await Database.Insert(Setting);

                    return(true);
                }
                else
                {
                    if (Setting.Value != Value)
                    {
                        Setting.Value = Value;
                        await Database.Update(Setting);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            finally
            {
                await synchObject.EndWrite();
            }
        }
示例#2
0
        /// <summary>
        /// Sets a TimeSpan-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, TimeSpan Value)
        {
            using (Semaphore Semaphore = await Semaphores.BeginWrite("setting:" + Key))
            {
                TimeSpanSetting Setting = await Database.FindFirstDeleteRest <TimeSpanSetting>(new FilterFieldEqualTo("Key", Key));

                if (Setting is null)
                {
                    Setting = new TimeSpanSetting(Key, Value);
                    await Database.Insert(Setting);

                    return(true);
                }
                else
                {
                    if (Setting.Value != Value)
                    {
                        Setting.Value = Value;
                        await Database.Update(Setting);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Sets a TimeSpan-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, TimeSpan Value)
        {
            foreach (TimeSpanSetting Setting in await Database.Find <TimeSpanSetting>(new FilterFieldEqualTo("Key", Key)))
            {
                if (Setting.Value != Value)
                {
                    Setting.Value = Value;
                    await Database.Update(Setting);

                    //Log.Informational("Setting updated.", Key, new KeyValuePair<string, object>("Value", Value));
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            TimeSpanSetting NewSetting = new TimeSpanSetting(Key, Value);
            await Database.Insert(NewSetting);

            //Log.Informational("Setting created.", Key, new KeyValuePair<string, object>("Value", Value));

            return(true);
        }
示例#4
0
        /// <summary>
        /// Sets a TimeSpan-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, TimeSpan Value)
        {
            using (Semaphore Semaphore = await Semaphores.BeginWrite("setting:" + Key))
            {
                TimeSpanSetting Setting = await Database.FindFirstDeleteRest <TimeSpanSetting>(new FilterFieldEqualTo("Key", Key));

                return(await SetAsyncLocked(Key, Value, Setting));
            }
        }
示例#5
0
        private static async Task <bool> SetAsyncLocked(string Key, TimeSpan Value, TimeSpanSetting Setting)
        {
            if (Setting is null)
            {
                Setting = new TimeSpanSetting(Key, Value);
                await Database.Insert(Setting);

                return(true);
            }
            else
            {
                if (Setting.Value != Value)
                {
                    Setting.Value = Value;
                    await Database.Update(Setting);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#6
0
        public void DbAppSetting_TimeSpan()
        {
            TimeSpanSetting setting = new TimeSpanSetting();

            Assert.IsTrue(setting.InitialValue == new TimeSpan(1, 1, 1, 1));
            Assert.IsTrue(setting.InternalValue == new TimeSpan(1, 1, 1, 1));

            DbAppSettingDto settingDto = new DbAppSettingDto()
            {
                Key = setting.FullSettingName, Value = new TimeSpan(2, 1, 1, 1).ToString(), Type = setting.TypeString
            };

            setting.From(settingDto);

            Assert.IsTrue(setting.InitialValue == new TimeSpan(1, 1, 1, 1));
            Assert.IsTrue(setting.InternalValue == new TimeSpan(2, 1, 1, 1));

            DbAppSettingDto toDto = setting.ToDto();

            Assert.IsTrue(toDto.ApplicationKey == settingDto.ApplicationKey);
            Assert.IsTrue(toDto.Key == settingDto.Key);
            Assert.IsTrue(toDto.Type == settingDto.Type);
            Assert.IsTrue(toDto.Value.Equals(settingDto.Value, StringComparison.InvariantCultureIgnoreCase));
        }
示例#7
0
文件: Config.cs 项目: haefele/Mileage
 static Config()
 {
     EmbeddedDatabaseName = new StringSetting("Mileage/EmbeddedDatabaseName", "./Database.db");
     WebServiceAddress    = new StringSetting("Mileage/WebServiceAddress", string.Empty);
     KeyDownDelay         = new TimeSpanSetting("Mileage/KeyDownDelay", TimeSpan.FromMilliseconds(300));
 }
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                                                          // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                          Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb  = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize       = new IntegerSetting(settings["Raven/Voron/MaxBufferPoolSize"], 4);
            Voron.InitialFileSize         = new NullableIntegerSetting(settings["Raven/Voron/InitialFileSize"], (int?)null);
            Voron.MaxScratchBufferSize    = new IntegerSetting(settings["Raven/Voron/MaxScratchBufferSize"], 1024);
            Voron.AllowIncrementalBackups = new BooleanSetting(settings["Raven/Voron/AllowIncrementalBackups"], false);
            Voron.TempPath = new StringSetting(settings["Raven/Voron/TempPath"], (string)null);

            Replication.FetchingFromDiskTimeoutInSeconds        = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings["Raven/FileSystem/MaximumSynchronizationInterval"], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath       = new StringSetting(settings["Raven/FileSystem/IndexStoragePath"], (string)null);
            FileSystem.DataDir                = new StringSetting(settings["Raven/FileSystem/DataDir"], @"~\Data\FileSystem");
            FileSystem.DefaultStorageTypeName = new StringSetting(settings["Raven/FileSystem/Storage"], InMemoryRavenConfiguration.VoronTypeName);

            Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], InMemoryRavenConfiguration.VoronTypeName);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);
            JournalsStoragePath      = new StringSetting(settings["Raven/Esent/LogsPath"] ?? settings[Constants.RavenTxJournalPath], (string)null);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);
        }
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            //1024 is Lucene.net default - so if the setting is not set it will be the same as not touching Lucene's settings at all
            MaxClauseCount = new IntegerSetting(settings[Constants.MaxClauseCount], 1024);

            AllowScriptsToAdjustNumberOfSteps = new BooleanSetting(settings[Constants.AllowScriptsToAdjustNumberOfSteps], false);

            IndexAndTransformerReplicationLatencyInSec = new IntegerSetting(settings[Constants.RavenIndexAndTransformerReplicationLatencyInSec], Constants.DefaultRavenIndexAndTransformerReplicationLatencyInSec);

            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentRequestsForDatabaseDuringLoad = new IntegerSetting(settings[Constants.MaxConcurrentRequestsForDatabaseDuringLoad], 50);

            MaxSecondsForTaskToWaitForDatabaseToLoad = new IntegerSetting(settings[Constants.MaxSecondsForTaskToWaitForDatabaseToLoad], 5);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemoryInMb * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);

            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxTime =
                new TimeSpanSetting(settings["Raven/NewIndexInMemoryMaxTime"], TimeSpan.FromMinutes(15), TimeSpanArgumentType.FromParse);
            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings[Constants.RunInMemory], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            WorkingDir =
                new StringSetting(settings["Raven/WorkingDir"], @"~\");
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Databases\System");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            ExposeConfigOverTheWire =
                new StringSetting(settings[Constants.ExposeConfigOverTheWire], "Open");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            AssembliesDirectory =
                new StringSetting(settings["Raven/AssembliesDirectory"], @"~\Assemblies");
            EmbeddedFilesDirectory =
                new StringSetting(settings["Raven/EmbeddedFilesDirectory"], (string)null);
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            RejectClientsModeEnabled =
                new BooleanSetting(settings[Constants.RejectClientsModeEnabled], false);

            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            TurnOffDiscoveryClient = new BooleanSetting(settings["Raven/TurnOffDiscoveryClient"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize = new IntegerSetting(settings[Constants.Voron.MaxBufferPoolSize], 4);
            Voron.InitialFileSize = new NullableIntegerSetting(settings[Constants.Voron.InitialFileSize], (int?)null);
            Voron.MaxScratchBufferSize = new IntegerSetting(settings[Constants.Voron.MaxScratchBufferSize], 6144);

            var maxScratchBufferSize = Voron.MaxScratchBufferSize.Value;
            var scratchBufferSizeNotificationThreshold = -1;
            if (maxScratchBufferSize > 1024)
                scratchBufferSizeNotificationThreshold = 1024;
            else if (maxScratchBufferSize > 512)
                scratchBufferSizeNotificationThreshold = 512;
            Voron.ScratchBufferSizeNotificationThreshold = new IntegerSetting(settings[Constants.Voron.ScratchBufferSizeNotificationThreshold], scratchBufferSizeNotificationThreshold);

            Voron.AllowIncrementalBackups = new BooleanSetting(settings[Constants.Voron.AllowIncrementalBackups], false);
            Voron.AllowOn32Bits = new BooleanSetting(settings[Constants.Voron.AllowOn32Bits], false);
            Voron.TempPath = new StringSetting(settings[Constants.Voron.TempPath], (string)null);

            var txJournalPath = settings[Constants.RavenTxJournalPath];
            var esentLogsPath = settings[Constants.RavenEsentLogsPath];

            Voron.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(txJournalPath) ? esentLogsPath : txJournalPath, (string)null);

            Esent.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(esentLogsPath) ? txJournalPath : esentLogsPath, (string)null);

            var defaultCacheSize = Environment.Is64BitProcess ? Math.Min(1024, (MemoryStatistics.TotalPhysicalMemory / 4)) : 256;
            Esent.CacheSizeMax = new IntegerSetting(settings[Constants.Esent.CacheSizeMax], defaultCacheSize);
            Esent.MaxVerPages = new IntegerSetting(settings[Constants.Esent.MaxVerPages], 512);
            Esent.PreferredVerPages = new IntegerSetting(settings[Constants.Esent.PreferredVerPages], 472);
            Esent.DbExtensionSize = new IntegerSetting(settings[Constants.Esent.DbExtensionSize], 8);
            Esent.LogFileSize = new IntegerSetting(settings[Constants.Esent.LogFileSize], 64);
            Esent.LogBuffers = new IntegerSetting(settings[Constants.Esent.LogBuffers], 8192);
            Esent.MaxCursors = new IntegerSetting(settings[Constants.Esent.MaxCursors], 2048);
            Esent.CircularLog = new BooleanSetting(settings[Constants.Esent.CircularLog], true);

            Replication.FetchingFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);
            Replication.ForceReplicationRequestBuffering = new BooleanSetting(settings["Raven/Replication/ForceReplicationRequestBuffering"], false);
            Replication.MaxNumberOfItemsToReceiveInSingleBatch = new NullableIntegerSettingWithMin(settings["Raven/Replication/MaxNumberOfItemsToReceiveInSingleBatch"], (int?)null, 512);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings[Constants.FileSystem.MaximumSynchronizationInterval], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath = new StringSetting(settings[Constants.FileSystem.IndexStorageDirectory], string.Empty);
            FileSystem.DataDir = new StringSetting(settings[Constants.FileSystem.DataDirectory], @"~\FileSystems");
            FileSystem.DefaultStorageTypeName = new StringSetting(settings[Constants.FileSystem.Storage], string.Empty);
            FileSystem.PreventSchemaUpdate = new BooleanSetting(settings[Constants.FileSystem.PreventSchemaUpdate], false);
            Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            Indexing.MaxNumberOfItemsToProcessInTestIndexes = new IntegerSetting(settings[Constants.MaxNumberOfItemsToProcessInTestIndexes], 512);
            Indexing.DisableIndexingFreeSpaceThreshold = new IntegerSetting(settings[Constants.Indexing.DisableIndexingFreeSpaceThreshold], 2048);
            Indexing.DisableMapReduceInMemoryTracking = new BooleanSetting(settings[Constants.Indexing.DisableMapReduceInMemoryTracking], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], string.Empty);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);

            ImplicitFetchFieldsFromDocumentMode = new EnumSetting<ImplicitFetchFieldsMode>(settings["Raven/ImplicitFetchFieldsFromDocumentMode"], ImplicitFetchFieldsMode.Enabled);

            if (settings["Raven/MaxServicePointIdleTime"] != null)
                ServicePointManager.MaxServicePointIdleTime = Convert.ToInt32(settings["Raven/MaxServicePointIdleTime"]);

            WebSockets.InitialBufferPoolSize = new IntegerSetting(settings["Raven/WebSockets/InitialBufferPoolSize"], 128 * 1024);

            MaxConcurrentResourceLoads = new IntegerSetting(settings[Constants.RavenMaxConcurrentResourceLoads], 8);
            ConcurrentResourceLoadTimeout = new TimeSpanSetting(settings[Constants.ConcurrentResourceLoadTimeout],
                TimeSpan.FromSeconds(15),
                TimeSpanArgumentType.FromParse);

            CacheDocumentsInMemory = new BooleanSetting(settings["Raven/CacheDocumentsInMemory"], true);
        }
示例#10
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            //1024 is Lucene.net default - so if the setting is not set it will be the same as not touching Lucene's settings at all
            MaxClauseCount = new IntegerSetting(settings[Constants.MaxClauseCount], 1024);

            AllowScriptsToAdjustNumberOfSteps = new BooleanSetting(settings[Constants.AllowScriptsToAdjustNumberOfSteps], false);

            IndexAndTransformerReplicationLatencyInSec = new IntegerSetting(settings[Constants.RavenIndexAndTransformerReplicationLatencyInSec], Constants.DefaultRavenIndexAndTransformerReplicationLatencyInSec);

            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentRequestsForDatabaseDuringLoad = new IntegerSetting(settings[Constants.MaxConcurrentRequestsForDatabaseDuringLoad], 50);

            MaxSecondsForTaskToWaitForDatabaseToLoad = new IntegerSetting(settings[Constants.MaxSecondsForTaskToWaitForDatabaseToLoad], 5);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                                                          // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                          Math.Min(1024, (int)(MemoryStatistics.AvailableMemoryInMb * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxTime =
                new TimeSpanSetting(settings["Raven/NewIndexInMemoryMaxTime"], TimeSpan.FromMinutes(15), TimeSpanArgumentType.FromParse);
            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings[Constants.RunInMemory], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            WorkingDir =
                new StringSetting(settings["Raven/WorkingDir"], @"~\");
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Databases\System");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            ExposeConfigOverTheWire =
                new StringSetting(settings[Constants.ExposeConfigOverTheWire], "Open");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            AssembliesDirectory =
                new StringSetting(settings["Raven/AssembliesDirectory"], @"~\Assemblies");
            EmbeddedFilesDirectory =
                new StringSetting(settings["Raven/EmbeddedFilesDirectory"], (string)null);
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            RejectClientsModeEnabled =
                new BooleanSetting(settings[Constants.RejectClientsModeEnabled], false);

            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            TurnOffDiscoveryClient = new BooleanSetting(settings["Raven/TurnOffDiscoveryClient"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb  = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize    = new IntegerSetting(settings[Constants.Voron.MaxBufferPoolSize], 4);
            Voron.InitialFileSize      = new NullableIntegerSetting(settings[Constants.Voron.InitialFileSize], (int?)null);
            Voron.MaxScratchBufferSize = new IntegerSetting(settings[Constants.Voron.MaxScratchBufferSize], 6144);

            var maxScratchBufferSize = Voron.MaxScratchBufferSize.Value;
            var scratchBufferSizeNotificationThreshold = -1;

            if (maxScratchBufferSize > 1024)
            {
                scratchBufferSizeNotificationThreshold = 1024;
            }
            else if (maxScratchBufferSize > 512)
            {
                scratchBufferSizeNotificationThreshold = 512;
            }
            Voron.ScratchBufferSizeNotificationThreshold = new IntegerSetting(settings[Constants.Voron.ScratchBufferSizeNotificationThreshold], scratchBufferSizeNotificationThreshold);

            Voron.AllowIncrementalBackups = new BooleanSetting(settings[Constants.Voron.AllowIncrementalBackups], false);
            Voron.AllowOn32Bits           = new BooleanSetting(settings[Constants.Voron.AllowOn32Bits], false);
            Voron.TempPath = new StringSetting(settings[Constants.Voron.TempPath], (string)null);

            var txJournalPath = settings[Constants.RavenTxJournalPath];
            var esentLogsPath = settings[Constants.RavenEsentLogsPath];

            Voron.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(txJournalPath) ? esentLogsPath : txJournalPath, (string)null);

            Esent.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(esentLogsPath) ? txJournalPath : esentLogsPath, (string)null);

            Replication.FetchingFromDiskTimeoutInSeconds        = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);
            Replication.ForceReplicationRequestBuffering        = new BooleanSetting(settings["Raven/Replication/ForceReplicationRequestBuffering"], false);
            Replication.MaxNumberOfItemsToReceiveInSingleBatch  = new NullableIntegerSettingWithMin(settings["Raven/Replication/MaxNumberOfItemsToReceiveInSingleBatch"], (int?)null, 512);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings[Constants.FileSystem.MaximumSynchronizationInterval], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath            = new StringSetting(settings[Constants.FileSystem.IndexStorageDirectory], string.Empty);
            FileSystem.DataDir                     = new StringSetting(settings[Constants.FileSystem.DataDirectory], @"~\FileSystems");
            FileSystem.DefaultStorageTypeName      = new StringSetting(settings[Constants.FileSystem.Storage], string.Empty);
            FileSystem.PreventSchemaUpdate         = new BooleanSetting(settings[Constants.FileSystem.PreventSchemaUpdate], false);
            Encryption.UseFips                     = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            Indexing.MaxNumberOfItemsToProcessInTestIndexes = new IntegerSetting(settings[Constants.MaxNumberOfItemsToProcessInTestIndexes], 512);
            Indexing.DisableIndexingFreeSpaceThreshold      = new IntegerSetting(settings[Constants.Indexing.DisableIndexingFreeSpaceThreshold], 2048);
            Indexing.DisableMapReduceInMemoryTracking       = new BooleanSetting(settings[Constants.Indexing.DisableMapReduceInMemoryTracking], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], string.Empty);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);

            ImplicitFetchFieldsFromDocumentMode = new EnumSetting <ImplicitFetchFieldsMode>(settings["Raven/ImplicitFetchFieldsFromDocumentMode"], ImplicitFetchFieldsMode.Enabled);

            if (settings["Raven/MaxServicePointIdleTime"] != null)
            {
                ServicePointManager.MaxServicePointIdleTime = Convert.ToInt32(settings["Raven/MaxServicePointIdleTime"]);
            }

            WebSockets.InitialBufferPoolSize = new IntegerSetting(settings["Raven/WebSockets/InitialBufferPoolSize"], 128 * 1024);

            Http.AuthenticationSchemes = new EnumSetting <AuthenticationSchemes?>(settings["Raven/Http/AuthenticationSchemes"], (AuthenticationSchemes?)null);

            MaxConcurrentResourceLoads    = new IntegerSetting(settings[Constants.RavenMaxConcurrentResourceLoads], 8);
            ConcurrentResourceLoadTimeout = new TimeSpanSetting(settings[Constants.ConcurrentResourceLoadTimeout],
                                                                TimeSpan.FromSeconds(15),
                                                                TimeSpanArgumentType.FromParse);
        }
示例#11
0
        /// <summary>
        /// Gets a TimeSpan-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="DefaultValue">Default value, if not found.</param>
        /// <returns>Setting value.</returns>
        public static async Task <TimeSpan> GetAsync(string Key, TimeSpan DefaultValue)
        {
            TimeSpanSetting Setting = await GetAsync <TimeSpanSetting>(Key);

            return(Setting?.Value ?? DefaultValue);
        }
示例#12
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);
			TempIndexPromotionMinimumQueryCount =
				new IntegerSetting(settings["Raven/TempIndexPromotionMinimumQueryCount"], 100);
			TempIndexPromotionThreshold =
				new IntegerSetting(settings["Raven/TempIndexPromotionThreshold"], 60000 /* once a minute */);
			TempIndexCleanupPeriod =
				new TimeSpanSetting(settings["Raven/TempIndexCleanupPeriod"], TimeSpan.FromMinutes(10),
				                    TimeSpanArgumentType.FromSeconds);
			TempIndexCleanupThreshold =
				new TimeSpanSetting(settings["Raven/TempIndexCleanupThreshold"], TimeSpan.FromMinutes(20),
				                    TimeSpanArgumentType.FromSeconds);
			TempIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/TempIndexInMemoryMaxMB"], 25, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateTemporaryIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateTemporaryIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/HttpCompression"], (string) null);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
		}
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{

			PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

			MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

			MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

			MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75))); 

			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);
			
			
			MaxProcessingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
			MaxSimpleIndexOutputsPerDocument = 
				new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

			MaxMapReduceIndexOutputsPerDocument =
				new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

			MaxNumberOfItemsToProcessInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelProcessingTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DisableInMemoryIndexing =
				new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
			CountersDataDir =
				new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");
			
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], "*");
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetching =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"]?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

			DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

			MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

			Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
			Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize = new IntegerSetting(settings["Raven/Voron/MaxBufferPoolSize"], 4);
			Voron.InitialFileSize = new NullableIntegerSetting(settings["Raven/Voron/InitialFileSize"], (int?)null);
			Voron.MaxScratchBufferSize = new IntegerSetting(settings["Raven/Voron/MaxScratchBufferSize"], 512);
			Voron.AllowIncrementalBackups = new BooleanSetting(settings["Raven/Voron/AllowIncrementalBackups"], false);
			Voron.TempPath = new StringSetting(settings["Raven/Voron/TempPath"], (string) null);

			Replication.FetchingFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
			Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings["Raven/FileSystem/MaximumSynchronizationInterval"], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
			FileSystem.IndexStoragePath = new StringSetting(settings["Raven/FileSystem/IndexStoragePath"], (string)null);
			FileSystem.DataDir = new StringSetting(settings["Raven/FileSystem/DataDir"], @"~\Data\FileSystem");
			FileSystem.DefaultStorageTypeName = new StringSetting(settings["Raven/FileSystem/Storage"], InMemoryRavenConfiguration.VoronTypeName);

			Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
			Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
			Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

			DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], InMemoryRavenConfiguration.VoronTypeName);

			FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);
			JournalsStoragePath = new StringSetting(settings["Raven/Esent/LogsPath"] ?? settings[Constants.RavenTxJournalPath], (string)null);

			TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);
		}
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForIndexing = new IntegerSetting(settings[Constants.MemoryLimitForIndexing],
                                                        // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                        Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75)));

            EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting],
                                                             Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxIndexingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            PreventAutomaticSuggestionCreation =
                new BooleanSetting(settings["Raven/PreventAutomaticSuggestionCreation"], false);
            DisablePerformanceCounters =
                new BooleanSetting(settings["Raven/DisablePerformanceCounters"], false);

            MaxNumberOfItemsToIndexInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingIndexBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelIndexTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], (string)null);
            UseSsl =
                new BooleanSetting(settings["Raven/UseSsl"], false);
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetchingForIndexing =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetchForIndexing =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatbaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
            ServerName  = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);

            MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);
        }
示例#15
0
 public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
 {
     MaxPageSize =
         new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
     MemoryCacheLimitMegabytes =
         new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
     MemoryCacheExpiration =
         new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                             TimeSpanArgumentType.FromSeconds);
     MemoryCacheLimitPercentage =
         new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
     MemoryCacheLimitCheckInterval =
         new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                             TimeSpanArgumentType.FromParse);
     MaxIndexingRunLatency =
         new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                             TimeSpanArgumentType.FromParse);
     MaxNumberOfItemsToIndexInSingleBatch =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                   defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
     AvailableMemoryForRaisingIndexBatchSizeLimit =
         new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                            Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
     MaxNumberOfItemsToReduceInSingleBatch =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                   defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
     NumberOfItemsToExecuteReduceInSingleStep =
         new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
     MaxNumberOfParallelIndexTasks =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);
     TempIndexPromotionMinimumQueryCount =
         new IntegerSetting(settings["Raven/TempIndexPromotionMinimumQueryCount"], 100);
     TempIndexPromotionThreshold =
         new IntegerSetting(settings["Raven/TempIndexPromotionThreshold"], 60000 /* once a minute */);
     TempIndexCleanupPeriod =
         new TimeSpanSetting(settings["Raven/TempIndexCleanupPeriod"], TimeSpan.FromMinutes(10),
                             TimeSpanArgumentType.FromSeconds);
     TempIndexCleanupThreshold =
         new TimeSpanSetting(settings["Raven/TempIndexCleanupThreshold"], TimeSpan.FromMinutes(20),
                             TimeSpanArgumentType.FromSeconds);
     TempIndexInMemoryMaxMb =
         new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/TempIndexInMemoryMaxMB"], 25, 1), 1024 * 1024);
     RunInMemory =
         new BooleanSetting(settings["Raven/RunInMemory"], false);
     CreateTemporaryIndexesForAdHocQueriesIfNeeded =
         new BooleanSetting(settings["Raven/CreateTemporaryIndexesForAdHocQueriesIfNeeded"], true);
     ResetIndexOnUncleanShutdown =
         new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
     DataDir =
         new StringSetting(settings["Raven/DataDir"], @"~\Data");
     IndexStoragePath =
         new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
     HostName =
         new StringSetting(settings["Raven/HostName"], (string)null);
     Port =
         new StringSetting(settings["Raven/Port"], (string)null);
     HttpCompression =
         new BooleanSetting(settings["Raven/HttpCompression"], true);
     AccessControlAllowOrigin =
         new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
     AccessControlMaxAge =
         new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
     AccessControlAllowMethods =
         new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
     AccessControlRequestHeaders =
         new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
     RedirectStudioUrl =
         new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
     DisableDocumentPreFetchingForIndexing =
         new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
     WebDir =
         new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
     PluginsDirectory =
         new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
     TaskScheduler =
         new StringSetting(settings["Raven/TaskScheduler"], (string)null);
     AllowLocalAccessWithoutAuthorization =
         new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
 }
示例#16
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

			MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

			MemoryLimitForIndexing = new IntegerSetting(settings[Constants.MemoryLimitForIndexing],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75))); 

		    EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting],
		        Constants.DefaultKeySizeToUseInActualEncryptionInBits);
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);
			
			
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
			PreventAutomaticSuggestionCreation =
				new BooleanSetting(settings["Raven/PreventAutomaticSuggestionCreation"], false);
			DisablePerformanceCounters =
				new BooleanSetting(settings["Raven/DisablePerformanceCounters"], false);

			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DisableInMemoryIndexing =
				new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], (string) null);
			UseSsl = 
				new BooleanSetting(settings["Raven/UseSsl"], false);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetchForIndexing =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

			DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatbaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

			MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

			FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);

			MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);
		}
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);
            MaxIndexingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);

            MaxNumberOfItemsToIndexInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingIndexBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelIndexTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], (string)null);
            UseSsl =
                new BooleanSetting(settings["Raven/UseSsl"], false);
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetchingForIndexing =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetchForIndexing =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
            ServerName  = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);
        }
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);

			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], (string) null);
			UseSsl = 
				new BooleanSetting(settings["Raven/UseSsl"], false);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetchForIndexing =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);
		}