This commit is contained in:
周伟
2022-05-11 22:56:52 +08:00
parent d9c5ffd627
commit 85b6063789
2559 changed files with 545 additions and 30 deletions

View File

@@ -12,7 +12,9 @@
<!-- theme css & js -->
<meta name="generator" content="Hexo 4.2.0">
</head>
<body>
<div class="book-container">
<div class="book-sidebar">
<div class="book-brand">
@@ -25,61 +27,86 @@
<ul class="uncollapsible">
<li><a href="/" class="current-tab">首页</a></li>
</ul>
<ul class="uncollapsible">
<li><a href="../">上一级</a></li>
</ul>
<ul class="uncollapsible">
<li>
<a href="/极客时间/Java基础36讲.md.html">Java基础36讲.md.html</a>
</li>
<li>
<a href="/极客时间/Java错误示例100讲.md.html">Java错误示例100讲.md.html</a>
</li>
<li>
<a href="/极客时间/Linux性能优化.md.html">Linux性能优化.md.html</a>
</li>
<li>
<a href="/极客时间/MySQL实战45讲.md.html">MySQL实战45讲.md.html</a>
</li>
<li>
<a href="/极客时间/从0开始学微服务.md.html">从0开始学微服务.md.html</a>
</li>
<li>
<a href="/极客时间/代码精进之路.md.html">代码精进之路.md.html</a>
</li>
<li>
<a href="/极客时间/持续交付36讲.md.html">持续交付36讲.md.html</a>
</li>
<li>
<a href="/极客时间/程序员进阶攻略.md.html">程序员进阶攻略.md.html</a>
</li>
<li>
<a class="current-tab" href="/极客时间/趣谈网络协议.md.html">趣谈网络协议.md.html</a>
</li>
</ul>
</div>
</div>
<div class="sidebar-toggle" onclick="sidebar_toggle()" onmouseover="add_inner()" onmouseleave="remove_inner()">
<div class="sidebar-toggle-inner"></div>
</div>
<script>
function add_inner() {
let inner = document.querySelector('.sidebar-toggle-inner')
inner.classList.add('show')
}
function remove_inner() {
let inner = document.querySelector('.sidebar-toggle-inner')
inner.classList.remove('show')
}
function sidebar_toggle() {
let sidebar_toggle = document.querySelector('.sidebar-toggle')
let sidebar = document.querySelector('.book-sidebar')
@@ -95,6 +122,7 @@
}
}
function open_sidebar() {
let sidebar = document.querySelector('.book-sidebar')
let overlay = document.querySelector('.off-canvas-overlay')
@@ -107,7 +135,9 @@ function hide_canvas() {
sidebar.classList.remove('show')
overlay.classList.remove('show')
}
</script>
<div class="off-canvas-content">
<div class="columns">
<div class="column col-12 col-lg-12">
@@ -193,6 +223,7 @@ function hide_canvas() {
Date: Tue, 27 Mar 2018 16:50:26 GMT
Content-Type: text/html;charset=UTF-8
Content-Language: zh-CN
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
@@ -298,7 +329,7 @@ Content-Language: zh-CN
<p>那你知道ifconfig和ip addr的区别吗这是一个有关net-tools和iproute2的“历史”故事你刚来到第三节暂时不用了解这么细但这也是一个常考的知识点。</p>
<p>想象一下你登录进入一个被裁剪过的非常小的Linux系统中发现既没有ifconfig命令也没有ip addr命令你是不是感觉这个系统压根儿没法用这个时候你可以自行安装net-tools和iproute2这两个工具。当然大多数时候这两个命令是系统自带的。</p>
<p>安装好后我们来运行一下ip addr。不出意外应该会输出下面的内容。</p>
<pre><code><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9cbd6d6cdf9cddccacd">[email&#160;protected]</a>:~# ip addr
<pre><code><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88fae7e7fcc8fcedfbfc">[email&#160;protected]</a>:~# ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
@@ -2607,7 +2638,7 @@ ovs-vsctl set Interface tap0 ingress_policing_burst=10000
<p>我们构建一个拓扑图来看看OpenvSwitch的QoS是如何工作的。</p>
<p>首先在port上可以创建QoS规则一个QoS规则可以有多个队列Queue。</p>
<p><img src="assets/aafe1e0bfc6a87e3341b82485e41185b.jpg" alt="img" /></p>
<pre><code>ovs-vsctl set port first_br <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="51203e226c113f3426203e22">[email&#160;protected]</a> -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86ababefe2bbc6e8e3f1f7e9f5">[email&#160;protected]</a> create qos type=linux-htb other-config:max-rate=10000000 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7f0e0a1a0a1a0c424f423f0e4f">[email&#160;protected]</a>,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="16272b566727">[email&#160;protected]</a>,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="754748350447">[email&#160;protected]</a> -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b79a9aded38af7c687">[email&#160;protected]</a> create queue other-config:min-rate=3000000 other-config:max-rate=10000000 -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83aeaeeae7bec3f2b2">[email&#160;protected]</a> create queue other-config:min-rate=1000000 other-config:max-rate=10000000 -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8da0a0e4e9b0cdfcbf">[email&#160;protected]</a> create queue other-config:min-rate=6000000 other-config:max-rate=10000000
<pre><code>ovs-vsctl set port first_br <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bccdd3cf81fcd2d9cbcdd3cf">[email&#160;protected]</a> -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="98b5b5f1fca5d8f6fdefe9f7eb">[email&#160;protected]</a> create qos type=linux-htb other-config:max-rate=10000000 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="49383c2c3c2c3a747974093879">[email&#160;protected]</a>,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="77464a370646">[email&#160;protected]</a>,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="70424d300142">[email&#160;protected]</a> -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f0202464b126f5e1f">[email&#160;protected]</a> create queue other-config:min-rate=3000000 other-config:max-rate=10000000 -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="230e0e4a471e635212">[email&#160;protected]</a> create queue other-config:min-rate=1000000 other-config:max-rate=10000000 -- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3a1717535e077a4b08">[email&#160;protected]</a> create queue other-config:min-rate=6000000 other-config:max-rate=10000000
</code></pre>
<p>上面的命令创建了一个QoS规则对应三个Queue。min-rate就是上面的ratemax-rate就是上面的ceil。通过交换机的网络包要通过流表规则匹配后进入不同的队列。然后我们就可以添加流表规则Flow(first_br是br0上的port 5)。</p>
<pre><code>ovs-ofctl add-flow br0 &quot;in_port=6 nw_src=192.168.100.100 actions=enqueue:5:0&quot;
@@ -3319,6 +3350,7 @@ soap:encodingStyle=&quot;http://www.w3.org/2001/12/soap-encoding&quot;&gt;
Host: www.geektime.com
Content-Type: application/xml; charset=utf-8
Content-Length: nnn
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;order&gt;
&lt;date&gt;2018-07-01&lt;/date&gt;
@@ -3332,6 +3364,7 @@ Content-Length: nnn
Host: www.geektime.com
Content-Type: application/json; charset=utf-8
Content-Length: nnn
{
&quot;order&quot;: {
&quot;date&quot;: &quot;2018-07-01&quot;,
@@ -3448,10 +3481,12 @@ C # object definition (#0)
x92 # two fields
x05 color # color field name
x05 model # model field name
O # object def (long form)
x90 # object definition #0
x03 red # color field value
x08 corvette # model field value
x60 # object def #0 (short form)
x05 green # color field value
x05 civic # model field value
@@ -3522,9 +3557,11 @@ message Order {
required string author = 3;
required int price = 4;
}
message OrderResponse {
required string message = 1;
}
service PurchaseOrder {
rpc Purchase (Order) returns (OrderResponse) {}
}
@@ -3893,21 +3930,25 @@ Content-Length: nnn
</div>
</div>
</div>
</div>
</div>
</div>
<a class="off-canvas-overlay" onclick="hide_canvas()"></a>
</div>
<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v652eace1692a40cfa3763df669d7439c1639079717194" integrity="sha512-Gi7xpJR8tSkrpF7aordPZQlW2DLtzUlZcumS8dMQjwDHEnw9I7ZLyiOj/6tZStRBGtGgN6ceN6cMH8z7etPGlw==" data-cf-beacon='{"rayId":"709980c2dee48b66","version":"2021.12.0","r":1,"token":"1f5d475227ce4f0089a7cff1ab17c0f5","si":100}' crossorigin="anonymous"></script>
<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v652eace1692a40cfa3763df669d7439c1639079717194" integrity="sha512-Gi7xpJR8tSkrpF7aordPZQlW2DLtzUlZcumS8dMQjwDHEnw9I7ZLyiOj/6tZStRBGtGgN6ceN6cMH8z7etPGlw==" data-cf-beacon='{"rayId":"709ba3c3fc18fbdc","version":"2021.12.0","r":1,"token":"1f5d475227ce4f0089a7cff1ab17c0f5","si":100}' crossorigin="anonymous"></script>
</body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NPSEEVD756"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-NPSEEVD756');
var path = window.location.pathname
@@ -3921,12 +3962,14 @@ Content-Length: nnn
} else {
setCookie("lastPath", path)
}
function setCookie(cname, cvalue) {
var d = new Date();
d.setTime(d.getTime() + (180 * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires + ";path = /";
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
@@ -3936,5 +3979,7 @@ Content-Length: nnn
}
return "";
}
</script>
</html>