示例#1
0
        public ConfigurationProvider()
        {
            // Transaction Flushing
            TransactionFlushTripleCount = DefaultTransactionFlushTripleCount;

            // ResourceCacheLimit
            ResourceCacheLimit = DefaultResourceCacheLimit;

            // Connection String
            ConnectionString = null;

            // Query Caching
            QueryCache = GetQueryCache(true, DefaultQueryCacheMemory);

            // Persistence Type
            PersistenceType = DefaultPersistenceType;

            // Page Cache Size
            PageCacheSize = DefaultPageCacheSize;

            // StatsUpdate properties
            StatsUpdateTransactionCount = DefaultStatsUpdateTransactionCount;
            StatsUpdateTimespan         = DefaultStatsUpdateTimespan;

            // Cache Preload Configuration
            var preloadConfig = new PageCachePreloadConfiguration
            {
                DefaultCacheRatio = DefaultPreloadCacheRatio,
                Enabled           = DefaultPreloadCacheEnabled
            };

            EmbeddedServiceConfiguration = new EmbeddedServiceConfiguration(preloadConfig, false);
        }
 /// <summary>
 /// Initialize a new instance of the embedded service configuration options
 /// </summary>
 /// <param name="preloadConfiguration">OPTIONAL: Initial value of the <see cref="PreloadConfiguration"/> configuration option. Defaults to null (no page cache preload)</param>
 /// <param name="enableTransactionLoggingOnNewStores">OPTIONAL: Initial value of the <see cref="EnableTransactionLoggingOnNewStores"/> flag. Defaults to true.</param>
 public EmbeddedServiceConfiguration(
     PageCachePreloadConfiguration preloadConfiguration = null,
     bool enableTransactionLoggingOnNewStores = true)
 {
     PreloadConfiguration = preloadConfiguration;
     EnableTransactionLoggingOnNewStores = enableTransactionLoggingOnNewStores;
 }
示例#3
0
        private List <WarmupInfo> GetStoreWarmupInfo(PageCachePreloadConfiguration preloadConfiguration)
        {
            var warmupInfos = new List <WarmupInfo>();

            foreach (var storeName in ListStores())
            {
                StorePreloadConfiguration storeConfiguration;
                string storeLocation = Path.Combine(_baseLocation, storeName);
                if (preloadConfiguration.StorePreloadConfigurations != null &&
                    preloadConfiguration.StorePreloadConfigurations.TryGetValue(storeName, out storeConfiguration))
                {
                    if (storeConfiguration.CacheRatio > 0)
                    {
                        warmupInfos.Add(new WarmupInfo(storeName, storeConfiguration.CacheRatio,
                                                       GetStoreDataSize(storeLocation)));
                    }
                    else if (preloadConfiguration.DefaultCacheRatio > 0)
                    {
                        warmupInfos.Add(new WarmupInfo(storeName, preloadConfiguration.DefaultCacheRatio,
                                                       GetStoreDataSize(storeLocation)));
                    }
                }
                else if (preloadConfiguration.DefaultCacheRatio > 0)
                {
                    warmupInfos.Add(new WarmupInfo(storeName, preloadConfiguration.DefaultCacheRatio,
                                                   GetStoreDataSize(storeLocation)));
                }
            }
            return(warmupInfos);
        }
示例#4
0
 public void Warmup(PageCachePreloadConfiguration preloadConfiguration)
 {
     if (preloadConfiguration != null && preloadConfiguration.Enabled)
     {
         ThreadPool.QueueUserWorkItem(RunServerCoreWarmup, preloadConfiguration);
     }
 }
示例#5
0
 /// <summary>
 /// Initialize a new instance of the embedded service configuration options
 /// </summary>
 /// <param name="preloadConfiguration">OPTIONAL: Initial value of the <see cref="PreloadConfiguration"/> configuration option. Defaults to null (no page cache preload)</param>
 /// <param name="enableTransactionLoggingOnNewStores">OPTIONAL: Initial value of the <see cref="EnableTransactionLoggingOnNewStores"/> flag. Defaults to true.</param>
 public EmbeddedServiceConfiguration(
     PageCachePreloadConfiguration preloadConfiguration = null,
     bool enableTransactionLoggingOnNewStores           = true)
 {
     PreloadConfiguration = preloadConfiguration;
     EnableTransactionLoggingOnNewStores = enableTransactionLoggingOnNewStores;
 }
示例#6
0
 public ConfigurationProvider()
 {
     PageCacheSize               = DefaultPageCacheSize;
     ResourceCacheLimit          = DefaultResourceCacheLimit;
     PersistenceType             = PersistenceType.AppendOnly;
     QueryCache                  = new NullCache();
     StatsUpdateTimespan         = 0;
     StatsUpdateTransactionCount = 0;
     TransactionFlushTripleCount = 1000;
     PreloadConfiguration        = new PageCachePreloadConfiguration {
         Enabled = false
     };
 }
 public static ServerCore GetServerCore(string baseLocation, PageCachePreloadConfiguration preloadConfiguration)
 {
     lock (UpdateLock)
     {
         if (!ServerCores.ContainsKey(baseLocation))
         {
             var serverCore = new ServerCore(baseLocation, QueryCache, PersistenceType);
             if (preloadConfiguration != null)
             {
                 serverCore.Warmup(preloadConfiguration);
             }
             ServerCores.Add(baseLocation, serverCore);
         }
         return(ServerCores[baseLocation]);
     }
 }
示例#8
0
        public ConfigurationProvider()
        {
            var appSettings = ConfigurationManager.AppSettings;

            // Connection String
            ConnectionString = appSettings.Get(ConnectionStringPropertyName);

            // Page Cache Size
            PageCacheSize = GetApplicationSetting(PageCacheSizePropertyName, DefaultPageCacheSize);

            // ResourceCacheLimit
            ResourceCacheLimit = GetApplicationSetting(ResourceCacheLimitName, DefaultResourceCacheLimit);

            // Persistence Type
            var persistenceTypeSetting = appSettings.Get(PersistenceTypeName);

            if (!String.IsNullOrEmpty(persistenceTypeSetting))
            {
                switch (persistenceTypeSetting.ToLowerInvariant())
                {
                case PersistenceTypeAppendOnly:
                    PersistenceType = PersistenceType.AppendOnly;
                    break;

                case PersistenceTypeRewrite:
                    PersistenceType = PersistenceType.Rewrite;
                    break;

                default:
                    PersistenceType = DefaultPersistenceType;
                    break;
                }
            }
            else
            {
                PersistenceType = DefaultPersistenceType;
            }

            // Query Caching
            var enableQueryCacheString = appSettings.Get(EnableQueryCacheName);
            var enableQueryCache       = true;

            if (!string.IsNullOrEmpty(enableQueryCacheString))
            {
                enableQueryCache = bool.Parse(enableQueryCacheString);
            }
            var queryCacheMemory = GetApplicationSetting(QueryCacheMemoryName, DefaultQueryCacheMemory);

            QueryCache = GetQueryCache(enableQueryCache, queryCacheMemory);

            // StatsUpdate properties
            StatsUpdateTransactionCount = GetApplicationSetting(StatsUpdateTransactionCountName, 0);
            StatsUpdateTimespan         = GetApplicationSetting(StatsUpdateTimeSpanName, 0);

            // Transaction Flushing
            TransactionFlushTripleCount = GetApplicationSetting(TxnFlushTriggerPropertyName, DefaultTransactionFlushTripleCount);

            // Cache Preload Configuration
            PreloadConfiguration = new PageCachePreloadConfiguration
            {
                DefaultCacheRatio = GetApplicationSetting(CachePreloadRatioName, 0.5m),
                Enabled           = GetApplicationSetting(CachePreloadEnabledName, false)
            };
        }