Exemple #1
0
 def testRackspaceComputationalCosts(self):                
     cpu_usage = generate_random_usage(random.randint(1,100000), 'spikes')
     mem_usage = generate_random_usage(random.randint(1,100000), 'spikes')
     rackspace_cost = rackspace.get_optimal_rackspace(cpu_usage, mem_usage, False)
     self.assertTrue(rackspace_cost > 0)
     rackspace_cost = rackspace.get_optimal_rackspace([0], [0])
     self.assertTrue(rackspace_cost == 0)        
     
     # assure it's a monotonically increasing function
     cpu = random.randint(1,1000)
     mem = random.randint(1,1000)
     rackspace_cost = rackspace.get_optimal_rackspace([cpu], [mem])        
     rackspace_cost2 = rackspace.get_optimal_rackspace([cpu*1.2], [mem*1.2])        
     self.assertTrue(rackspace_cost <= rackspace_cost2)
Exemple #2
0
from sitio.analyser import aws, rackspace

# Calculate storage cost on two clouds: AWS and Rackspace
# Pricelists in csv format are located in sitio/analyser/pricelist folder.
ebs_storage_cost, s3_storage_cost = aws.get_storage_costs(storage_used)
rack_storage_costs = rackspace.get_storage_costs(storage_used)
print "Storage costs on AWS: $%s, $%s" %(ebs_storage_cost, s3_storage_cost)
print "Storage costs on Rackspace: $%s" % rack_storage_costs

# To calculate migration costs in a straightforward manner - simply migrating all the data - 
# we need to know two things: cost of moving out and cost of moving in.
aws_to_rack_migration_cost = aws.get_network_out_price(storage_used) + \
                            rackspace.get_network_in_price(storage_used)
print "Cost of migrating data from AWS to Rackspace: $%s " % aws_to_rack_migration_cost

# To get an estimate of how much a certain computational load would cost on a cloud, 
# we provide an implementation of the method described in 
# ''Towards a model for cloud computing cost estimation with reserved resources'', CLOUDCOMP'2010.
# It works by finding cheapest fit using LP of VM time and RAM consumption to cloud provider
# offering. The last boolean argument of the function signifies whether precise solution 
# is sought (True, results in solving NP problem) or approximate is enough (False, fast).
used_reserved_instances, ec2_cost = aws.get_optimal_ec2(cpu_usage, mem_usage, False)
print "Approximate cost on AWS EC2: $%s" % ec2_cost

# To use the same cpu_usage for Rackspace, we need to normalize use by Rackspace benchmark.
# This is an open issue, but some ad hoc testing showed that it is approximately x5 EC2 CU. YMMV.
cpu_usage = [5*x for x in cpu_usage]
rackspace_cost = rackspace.get_optimal_rackspace(cpu_usage, mem_usage, False)
print "Approximate cost of Rackspace: $%s" % rackspace_cost