由于项目计划书写作需要,重画了Qi Zhang, Mohamed Faten Zhani, Raouf Boutaba, Joseph L. Hellerstein,

Dynamic Heterogeneity-Aware Resource Provisioning in the Cloud. IEEE TRANSACTIONS ON CLOUD

COMPUTING, VOL. 2, NO. 1, JANUARY-MARCH 2014.中的TaskEvent分布统计图。原图更跟重画图如下:

原图:

重画图:

数据来源:

介绍:

https://code.google.com/p/googleclusterdata/wiki/ClusterData2011_1

所有文件列表及校验和:

https://commondatastorage.googleapis.com/clusterdata-2011-1/SHA256SUM

格式说明:

https://commondatastorage.googleapis.com/clusterdata-2011-1/schema.csv

数据文件示例连接:

https://commondatastorage.googleapis.com/clusterdata-2011-1/job_events/part-00017-of-00500.csv.gz

重画的步骤如下。

1 由于数据存放在https://commondatastorage.googleapis.com/clusterdata-2011-1/

需要翻墙才能访问,故所有数据处理都是在墙外的位于东亚的azure服务器完成的。故首先建一个云服务器,并完成环境配置。

(主要是装个python)

2 下载数据文件(数据总量较大,1.51G)

import urllib2

url = 'https://commondatastorage.googleapis.com/clusterdata-2011-1/'
f = open('C:\\SHA256SUM')
l = f.readlines()
f.close()
for i in l:
if i.count('task_events')>0:
fileAddr = i.split()[1][1:]
fileName = fileAddr.split('/')[1]
print 'downloading', fileName
data = urllib2.urlopen(url+fileAddr).read()
print 'saving', fileName
fileDown = open('C:\\task_events\\'+fileName, 'wb')
fileDown.write(data)
fileDown.close()

注意:

(1) 执行脚本前要将所有文件列表及校验和文件SHA256SUM

(https://commondatastorage.googleapis.com/clusterdata-2011-1/SHA256SUM)

放到C盘根目录下,它负责生成其他文件的下载链接。

(2) 这里只下载了task_events,如果要分析其他数据的话,参考前文提到的格式说明及介绍修改要下载的文件部分。

3 生成要处理的文件名

f = open('C:\\SHA256SUM')
l = f.readlines()
f.close()
fName = open('C:\\task_events_file_name.txt', 'w')
for i in l:
if i.count('task_events')>0:
fileAddr = i.split()[1][1:]
fileName = fileAddr.split('/')[1]
fName.write(fileName+'\r\n')
fName.close()

4 统计

import gzip

fName = open('C:\\task_events_file_name.txt')
fileNames = fName.readlines()
fName.close()
cntMapGratis = {}
cntMapProduction = {}
cntMapOthers = {}
#fileNames = ['part-00000-of-00500.csv.gz']
for l in fileNames:
print 'now at: '+ l.strip()
f = gzip.open('C:\\task_events\\'+l.strip())
for log in f.readlines():
log = log.split(',')
if log[9]!='' and log[10]!='':
index = log[9]+' '+log[10]
priority = int(log[8])
if priority <= 1: #Gratis Task
cntMap = cntMapGratis
elif priority >= 9 and priority <= 11:
cntMap = cntMapProduction
else:
cntMap = cntMapOthers
if not index in cntMap:
cntMap[index]=1
else:
cntMap[index]+=1
f.close()
fReasult = open('C:\\CPUandMEMuseGratis.txt', 'w')
for i in cntMapGratis:
fReasult.write(i+' '+str(cntMapGratis[i])+"\r\n")
fReasult.close() fReasult = open('C:\\CPUandMEMuseProduction.txt', 'w')
for i in cntMapProduction:
fReasult.write(i+' '+str(cntMapProduction[i])+"\r\n")
fReasult.close() fReasult = open('C:\\CPUandMEMuseOthers.txt', 'w')
for i in cntMapOthers:
fReasult.write(i+' '+str(cntMapOthers[i])+"\r\n")
fReasult.close()

5 使用matlab绘制

clear all
close all

%load('D:\\CPUandMEMuseGratis.txt')
%load('D:\\CPUandMEMuseProduction.txt')
load('D:\\CPUandMEMuseOther.txt')

%CPUandMEMuse = CPUandMEMuseGratis;
%CPUandMEMuse = CPUandMEMuseProduction;
CPUandMEMuse = CPUandMEMuseOther;
x=CPUandMEMuse(:,1);
y= CPUandMEMuse(:,2);
s = CPUandMEMuse(:,3)/10000000;
s = log(s);

%max_r = 0.002; %for production and gratis
max_r = 0.001; %for other only
s = s/max(s)*max_r;

for i=1:size(x)
if x(i) == 0 || y(i) == 0
s(i)=0;
end
end

t= 0:pi/10:2*pi;
figure();
grid on
for i=1:size(x)
if x(i)~=0 && y(i)~=0
pb=patch((s(i)*sin(t)*0.5+ x(i)),(s(i)*cos(t)+y(i)),'b','edgecolor','k');
alpha(pb,.3);
end
end
axis([0 0.5 0 1]);
xlabel('CPU size');
ylabel('Memory size');
set(gca,'FontSize',25);
set(get(gca,'XLabel'),'FontSize',30);
set(get(gca,'YLabel'),'FontSize',30);

%saveas(gcf,'D:\\CPUandMEMuseGratis.jpg')
%saveas(gcf,'D:\\CPUandMEMuseProduction.jpg')
saveas(gcf,'D:\\CPUandMEMDemandOther.jpg')

附注:

1. Task通过优先级划分类别的

0-1 是Gratis

9-11 是Production

其他(2-8) 是Other

2. 画图的时候,圆的半径表示数量的对数(log)

重画GoogleClusterTrace数据的更多相关文章

  1. 使用R画地图数据

    用R画地图数据 首先,从这里下载中国地图的GIS数据,这是一个压缩包,完全解压后包含三个文件(bou2_4p.dbf.bou2_4p.shp和bou2_4p.shx),将这三个文件解压到同一个目录下. ...

  2. Winform重画ComboBox背景色

    //返回hWnd参数所指定的窗口的设备环境. [System.Runtime.InteropServices.DllImport("user32.dll")] static ext ...

  3. 1000个圆点与PaintDC的使用,OnSize时重画很棒

    import wx import random class View(wx.Panel): def __init__(self, parent): super(View, self).__init__ ...

  4. winform下重画ListBox

    Windows Forms是由Win32 API封装的开发组件,最初是为了替代mfc,但却没有体现与Model View Controller架构对应的特色,进而在.net framework 3.0 ...

  5. 微信小程序使用原生WebSokcet实现断线重连及数据拼接

    以前做小程序为了应急找了个插件去链接WebSokcet,文章传送门. 回过头在新项目中再次使用时出现了些许问题,不一一赘述.遂决定好好用一下原生的WebSokcet. 一.说明 1.小程序原生的Web ...

  6. 017-Hadoop Hive sql语法详解7-去重排序、数据倾斜

    一.数据去重排序 1.1.去重 distinct与group by 尽量避免使用distinct进行排重,特别是大表操作,用group by代替 -- 不建议 select DISTINCT key ...

  7. python定时重跑获取数据

    做大数据的童鞋经常会写定时任务跑数据,由于任务之间的依赖(一般都是下游依赖上游的数据产出),所以经常会导致数据获取失败,因为很多人发现数据失败后 都会去查看日志,然后手动去执行自己的任务.下面我实现了 ...

  8. C# Excel数据验重及Table数据验重

    http://blog.csdn.net/jiankunking/article/details/38398087 最近在做导入Excel数据的时候,要检验数据是否重复: 1.要检验Excel数据本身 ...

  9. 如何使用Python画地图数据

    http://blog.csdn.net/wen_fei/article/details/78355699

随机推荐

  1. 将服务端select设置为非阻塞,处理更多业务

    服务端代码: #include<WinSock2.h> #include<Windows.h> #include<vector> #include<stdio ...

  2. 【Java 基础项目 - - Bank项目4】 对象构造/跨package调用

    UML设计: 文件组织: (注: 在bank4中,直接调用bank3的内容, 不再重复编写代码即可!) 代码编写Bank.java: package Banking_4; import Banking ...

  3. 性能分析之TCP全连接队列占满问题分析及优化过程(转载)

    前言 在对一个挡板系统进行测试时,遇到一个由于TCP全连接队列被占满而影响系统性能的问题,这里记录下如何进行分析及解决的. 理解下TCP建立连接过程与队列 从图中明显可以看出建立 TCP 连接的时候, ...

  4. kickstart批量装机脚本

    #!/bin/bash #安装必备的软件 yum -y install dhcp tftp-server tftp xinetd syslinux vsftpd yum -y install *kic ...

  5. LDA的参数确定和主题数确定方法

    主题数确定:困惑度计算,画出曲线,选择拐点,避免信息丢失和主题冗余 https://blog.csdn.net/u014449866/article/details/80218054 参数调节: 方法 ...

  6. toggle([speed],[easing],[fn]) 用于绑定两个或多个事件处理器函数,以响应被选元素的轮流的 click 事件。

    toggle([speed],[easing],[fn]) 概述 用于绑定两个或多个事件处理器函数,以响应被选元素的轮流的 click 事件. 如果元素是可见的,切换为隐藏的:如果元素是隐藏的,切换为 ...

  7. java超大文件上传

    上周遇到这样一个问题,客户上传高清视频(1G以上)的时候上传失败. 一开始以为是session过期或者文件大小受系统限制,导致的错误. 查看了系统的配置文件没有看到文件大小限制, web.xml中se ...

  8. neo4j︱与python结合的py2neo使用教程

    —- 目前的几篇相关:—– neo4j︱图数据库基本概念.操作罗列与整理(一) neo4j︱Cypher 查询语言简单案例(二) neo4j︱Cypher完整案例csv导入.关系联通.高级查询(三) ...

  9. Django基础之form表单

    1. form介绍 我们之前在HTML页面中利用form表单向后端提交数据时,都会写一些获取用户输入的标签并且用form标签把它们包起来. 与此同时, 我们在好多场景下都需要对用户的输入做校验, 比如 ...

  10. MIME协议(六) -- MIME实例分析

    MIME实例分析 了解MIME协议的基本组织结构后,下面用Outlook Express撰写出一封显示效果如图4所示的电子邮件,然后分析该邮件的源文件,以便读者更加深入地了解MIME协议. 1. 启动 ...