//XXXIS add more things if we need them?

            public EssesFlowCacheContext(Flow flow, UInt64 cacheSizeAllocated, CacheWritePolicy writePolicy, CacheWriteBuffer cacheWrites, string cacheCurvePointsFile, string tenantID)
            {
                Flow = flow;
                this.cacheSizeAllocated = cacheSizeAllocated;
                this.writePolicy = writePolicy;
                this.cacheWrites = cacheWrites;
                this.hitRate = 0.0F;
                this.tenantID = tenantID;

                this.demandPointsSerializationFile = cacheCurvePointsFile;
                
                if (File.Exists(this.demandPointsSerializationFile))
                {
                    readInCacheCurve();
                    this.useSerializedCurve = true;
                }
                else
                {
                    this.cacheDemandCurvePoints = null;
                    this.cacheDemandFunc = null;
                    this.useSerializedCurve = false;
                }

#if COLLECT_CACHE_CURVE
                Console.CancelKeyPress += new ConsoleCancelEventHandler(Controller_CancelKeyPress);
#endif
            }
Exemple #2
0
            //XXXIS add more things if we need them?

            public EssesFlowCacheContext(Flow flow, UInt64 cacheSizeAllocated, CacheWritePolicy writePolicy, CacheWriteBuffer cacheWrites, string cacheCurvePointsFile, string tenantID)
            {
                Flow = flow;
                this.cacheSizeAllocated = cacheSizeAllocated;
                this.writePolicy        = writePolicy;
                this.cacheWrites        = cacheWrites;
                this.hitRate            = 0.0F;
                this.tenantID           = tenantID;

                this.demandPointsSerializationFile = cacheCurvePointsFile;

                if (File.Exists(this.demandPointsSerializationFile))
                {
                    readInCacheCurve();
                    this.useSerializedCurve = true;
                }
                else
                {
                    this.cacheDemandCurvePoints = null;
                    this.cacheDemandFunc        = null;
                    this.useSerializedCurve     = false;
                }

#if COLLECT_CACHE_CURVE
                Console.CancelKeyPress += new ConsoleCancelEventHandler(Controller_CancelKeyPress);
#endif
            }
Exemple #3
0
 /// <summary>
 /// Sets the cache write policy
 /// </summary>
 /// <param name="policy"></param>
 public void SetCacheWritePolicy(CacheWritePolicy policy)
 {
     this.writePolicy = policy;
 }
Exemple #4
0
        public OktofsPolicyEsses(string configFileName, string topConfigName, int slavePort)
        {
            shutdownEvent = new ManualResetEvent(false);
            //
            // initialize rate controller
            // parsing the config file defines VM placement and VM ordering within a traffic matrix
            //
            Random random   = new Random();
            uint   TenantId = (uint)random.Next(1, int.MaxValue); // min P of collision at slaves.

            rateController = new OktofsRateController(this, TenantId, slavePort);

            InitBandwidthWeights(BWWeightsConfigFile); //initialize the bandwidth weights from the appropriate config file

            string[] validInputRecords = new string[] { "D-VM-FILE-VOL", "CD-VM-FILE-VOL", "CH-VM-FILE-VOL", "C-VM-SHARE-VOL", "H-VM-SHARE-VOL", "CH-VM-SHARE-VOL" };
            listFlows = rateController.InitListFlows(configFileName, validInputRecords);

            fileCaches = new Dictionary <string, EssesFileCacheContext>();

            //Initialize some controller-side context about each flow's cache and the file caches they belong to based on the input tokens stored when flows were created
            foreach (Flow flow in listFlows)
            {
                UInt64 fileCacheSize = Convert.ToUInt64(flow.InputTokens[9]);
                string flowTenantID  = flow.InputTokens[12];

                if (!this.fileCaches.ContainsKey(flowTenantID))
                {
                    this.fileCaches.Add(flowTenantID, new EssesFileCacheContext(fileCacheSize));
                }


                this.fileCaches[flowTenantID].flows.Add(flow); //Add this flow to the context for this file cache

                UInt64           flowCacheSizeAllocated = Convert.ToUInt64(flow.InputTokens[5]);
                CacheWritePolicy writePolicy            = 0;
                CacheWriteBuffer cacheWrites            = 0;
                switch (flow.InputTokens[7])
                {
                case "write-through":
                    writePolicy = CacheWritePolicy.WriteThrough;
                    break;
                }
                switch (flow.InputTokens[8])
                {
                case "noCacheWrites":
                    cacheWrites = CacheWriteBuffer.noCache;
                    break;

                case "CacheWrites":
                    cacheWrites = CacheWriteBuffer.Cache;
                    break;
                }
                EssesFlowCacheContext flowContext = new EssesFlowCacheContext(flow, flowCacheSizeAllocated, writePolicy, cacheWrites, flow.InputTokens[11], flowTenantID);
                flow.Context = flowContext;

                //flowContext.minFlowGuarantee = Convert.ToUInt64(flow.InputTokens[10]);

                flowContext.guaranteedE2EBW = Convert.ToUInt64(flow.InputTokens[13]);
            }

            //
            // ask Rate Controller to create the queues on the remote servers.
            //
            rateController.InstallFlows();

            //
            // At this point the Rate Controller is connected to the rate slaves and the
            // minifilter drivers are configured with queues. The minifilters will not enforce
            // rate limits until we install the RAPs, which is done in the Start() routine.
            //
        }
Exemple #5
0
 /// <summary>
 /// Sets the cache write policy
 /// </summary>
 /// <param name="policy"></param>
 public void SetCacheWritePolicy(CacheWritePolicy policy)
 {
     this.writePolicy = policy;
 }