commit
19b60a8aa4
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Pull Request Documentation</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
<textarea id="source">
|
||||
</textarea>
|
||||
-->
|
||||
<script src="../js/remark.min.js"> </script>
|
||||
<script>
|
||||
var slideshow = remark.create({
|
||||
sourceUrl: 'source.md'
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
<script type="text/javascript" src="http://cdn.bootcss.com/mermaid/0.5.8/mermaid.min.js"></script>
|
||||
<link rel="stylesheet" href="http://cdn.bootcss.com/mermaid/0.5.8/mermaid.min.css">
|
||||
<script>mermaid.initialize({startOnLoad:true});</script>
|
||||
-->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,50 @@
|
|||
class: center, middle
|
||||
|
||||
# Monitor功能的优化
|
||||
|
||||
信科13级 朱域坚
|
||||
|
||||
---
|
||||
|
||||
# 主要完成的工作
|
||||
|
||||
1. 容器和物理机磁盘使用信息的监控
|
||||
2. 性能优化:以rpc机制代替原来的etcd传递信息
|
||||
3. 容器真实运行时间的统计
|
||||
|
||||
---
|
||||
|
||||
# 磁盘使用信息的监控
|
||||
|
||||
- 利用python模块psutil的`disk_usage`函数收集信息。
|
||||
- 该函数可以收集所有挂载的磁盘使用信息,由于容器使用时会分一个单独的磁盘挂载到它的根目录,因此可以收集到。
|
||||
|
||||
---
|
||||
|
||||
# 用rpc机制代替原来的etcd
|
||||
|
||||
## etcd存在的问题
|
||||
|
||||
- 读写效率太低:etcd每秒大约只能进行千次的读写,若每个容器每秒需要写一次,那最多只能支持千个容器同时存在,这是远远不够的。
|
||||
- 消耗资源过多:etcd的读写是通过http协议进行的,效率比较低,经测试,单个worker每秒写个位数的容器信息也要占用1%以上的CPU
|
||||
|
||||
---
|
||||
|
||||
# 原来的设计
|
||||
|
||||
![](images/monitor.jpg)
|
||||
|
||||
---
|
||||
|
||||
# rpc机制的设计
|
||||
|
||||
![](images/newmonitor.jpg)
|
||||
- 现有的worker负载cpu使用率降到0.5以下
|
||||
|
||||
---
|
||||
|
||||
# 真实运行时间的统计
|
||||
- 根据容器的pid, 利用ps命令收集容器运行的时间,只是进程运行时间,容器重启后进程会变
|
||||
- 因此真实时间还要加上lasttime,初始时为0
|
||||
- 若收集过程中pid与之前不同,说明容器重启了,则把之前的时间放到lasttime里
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from flask import session
|
||||
from flask import session, redirect
|
||||
from webViews.view import normalView
|
||||
from webViews.dockletrequest import dockletRequest
|
||||
from webViews.dashboard import *
|
||||
|
@ -34,7 +34,7 @@ class createClusterView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/create/", data)
|
||||
if(result.get('success', None) == "true"):
|
||||
return dashboardView.as_view()
|
||||
return redirect("/dashboard/")
|
||||
#return self.render(self.template_path, user = session['username'])
|
||||
else:
|
||||
return self.render(self.error_path, message = result.get('message'))
|
||||
|
@ -73,7 +73,7 @@ class scaleoutView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/scaleout/", data)
|
||||
if(result.get('success', None) == "true"):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
return self.render(self.error_path, message = result.get('message'))
|
||||
|
||||
|
@ -86,7 +86,7 @@ class scaleinView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/scalein/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
@ -112,7 +112,7 @@ class startClusterView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/start/", data)
|
||||
if(result):
|
||||
return dashboardView.as_view()
|
||||
return redirect("/dashboard/")
|
||||
else:
|
||||
return self.error()
|
||||
|
||||
|
@ -126,7 +126,7 @@ class stopClusterView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/stop/", data)
|
||||
if(result):
|
||||
return dashboardView.as_view()
|
||||
return redirect("/dashboard/")
|
||||
else:
|
||||
return self.error()
|
||||
|
||||
|
@ -160,7 +160,7 @@ class deleteClusterView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/cluster/delete/", data)
|
||||
if(result):
|
||||
return dashboardView.as_view()
|
||||
return redirect("/dashboard/")
|
||||
else:
|
||||
return self.error()
|
||||
|
||||
|
@ -199,7 +199,7 @@ class saveImageView(normalView):
|
|||
if(result):
|
||||
if result.get('success') == 'true':
|
||||
#return self.render(self.success_path, user = session['username'])
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
#res = detailClusterView()
|
||||
#res.clustername = self.clustername
|
||||
#return res.as_view()
|
||||
|
@ -221,7 +221,7 @@ class shareImageView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/image/share/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
@ -235,7 +235,7 @@ class unshareImageView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/image/unshare/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
@ -249,7 +249,7 @@ class deleteImageView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/image/delete/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
@ -264,7 +264,7 @@ class addproxyView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/addproxy/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
@ -277,7 +277,7 @@ class deleteproxyView(normalView):
|
|||
}
|
||||
result = dockletRequest.post("/deleteproxy/", data)
|
||||
if(result):
|
||||
return configView.as_view()
|
||||
return redirect("/config/")
|
||||
else:
|
||||
self.error()
|
||||
|
||||
|
|
Loading…
Reference in New Issue