segmentsperinterval = 1
if segmentinterval == 0:
    segmentinterval = 1
    segmentsperinterval = int(math.floor(segmentcountinrunphase / totaltime))
coordinatorinterval = 5 * segmentinterval
preloadsegment += totaltime % segmentcountinrunphase

print("Total Time: %d" % totaltime)
print("Pre Load Segment Count: %d" % preloadsegment)
print("Segment Count in Run Phase: %d" % segmentcountinrunphase)
print("Segment Interval: %d" % segmentinterval)
print("Segments per Interval: %s" % segmentsperinterval)

#### LOAD Phase ####
print "Pre loading segments and adding to deep storage"
segmentlist = RealTimeNode.generateSegments(preloadsegment)
deepstorage.extend(segmentlist)
segmentrunningcount = len(deepstorage)
RealTimeNode.printlist(segmentlist)

#### RUN Phase ####
for time in xrange(totaltime):
    #Generating Queries
    print "Generating Queries"
    maxquerysize = min(segmentrunningcount, querymaxsize)
    minquerysize = min(queryminsize, maxquerysize)
    newquerylist = QueryGenerator.generateQueries(queryperinterval, segmentrunningcount, DistributionFactory.createSegmentDistribution(querysegmentdistribution), minquerysize, maxquerysize, DistributionFactory.createSizeDistribution(querysizedistribution));
    Utils.printQueryList(newquerylist)
    allquerylist.extend(newquerylist)

    #Routing Queries
segmentsperinterval = 1
if segmentinterval == 0:
    segmentinterval = 1
    segmentsperinterval = int(math.floor(segmentcountinrunphase / totaltime))
coordinatorinterval = 5 * segmentinterval
preloadsegment += totaltime % segmentcountinrunphase

print("Total Time: %d" % totaltime)
print("Pre Load Segment Count: %d" % preloadsegment)
print("Segment Count in Run Phase: %d" % segmentcountinrunphase)
print("Segment Interval: %d" % segmentinterval)
print("Segments per Interval: %s" % segmentsperinterval)

#### LOAD Phase ####
print "Pre loading segments and adding to deep storage"
segmentlist = RealTimeNode.generateSegments(preloadsegment)
deepstorage.extend(segmentlist)
segmentrunningcount = len(deepstorage)
RealTimeNode.printlist(segmentlist)

#### RUN Phase ####
for time in xrange(totaltime):
    #Generating Queries
    print "Generating Queries"
    maxquerysize = min(segmentrunningcount, querymaxsize)
    minquerysize = min(queryminsize, maxquerysize)
    newquerylist = QueryGenerator.generateQueries(
        queryperinterval, segmentrunningcount,
        DistributionFactory.createSegmentDistribution(
            querysegmentdistribution), minquerysize, maxquerysize,
        DistributionFactory.createSizeDistribution(querysizedistribution))
Exemple #3
0
config.printConfig()

segmentcount = config.getSegmentCount()
querycount = config.getQueryCount()
querysegmentdistribution = config.getQuerySegmentDistribution()
querysizedistribution = config.getQuerySizeDistribution()
queryminsize = config.getQueryMinSize()
querymaxsize = config.getQueryMaxSize()
historicalnodecount = config.getHistoricalNodeCount()
placementstrategy = config.getPlacementStrategy()
replicationfactor = config.getReplicationFactor()
percentreplicate = config.getPercentReplicate()

#Generating Segments indexed starting from 1
print "Generating Segments"
segmentlist = RealTimeNode.generateSegments(segmentcount)
RealTimeNode.printlist(segmentlist)

#Generating Queries
print "Generating Queries"
querylist = QueryGenerator.generateQueries(querycount, segmentcount, DistributionFactory.createSegmentDistribution(querysegmentdistribution), queryminsize, querymaxsize, DistributionFactory.createSizeDistribution(querysizedistribution));
printQueryList(querylist)

###  DRUID COST BASED
placementstrategy = "druidcostbased"

for replicationfactor in xrange(2, 3):
	### Random Routing Stretagy
	routingstrategy = "random"
	runExperiment(historicalnodecount, segmentlist, percentreplicate, replicationfactor, querylist, placementstrategy, routingstrategy)
print("Total Time: %d" % totaltime)
print("Query Per Interval: %d" % queryperinterval)
print("Total Queries: %d" % totalqueries)

#### RUN Phase ####
for time in xrange(1,totaltime+1):

    #Generating Segments indexed starting from 1
    print "Generating Segments and adding to deep storage"
    numsegments = segmentsperinterval
    if burstysegment == True and time % burstysegmentinterval == 0:
        print "Segment Burst"
        numsegments *= burstysegmentmultiplier

    newsegments = RealTimeNode.generateSegments(time, segmentrunningcount+1, numsegments)
    RealTimeNode.printlist(newsegments)
    segmentlist.extend(newsegments)
    deepstorage[time] = newsegments
    segmentrunningcount += numsegments

    if time >= warmuptime:
        #Generating Queries
        print "Generating Queries"
        if changequerydistribution == True and time == changedistributionat:
            print "Distribution Change"
            querysegmentdistribution=newquerysegmentdistribution
        
        maxqueryperiod = min(time, querymaxsize)
        minqueryperiod = min(queryminsize, maxqueryperiod)