-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy path18-java-9.html
155 lines (144 loc) · 6.84 KB
/
18-java-9.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>葡萄藤PPT</title>
<link rel="stylesheet" href="./css/reveal/reveal.css">
<!-- PPT主题,可以在/css/reveal/theme/中选择其他主题,目前暂时只能使用该模板 -->
<link rel="stylesheet" href="./css/reveal/theme/ptt.css">
<!-- syntax highlighting 代码高亮主题 -->
<link rel="stylesheet" href="./lib/reveal/css/zenburn.css">
<!-- 打印和PDF输出样式 -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? './css/reveal/print/pdf.css' : '../css/reveal/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<img src="./img/demo/logo.png" alt="" usemap="#pttmap" class="base-logo">
<map name="pttmap">
<area shape="rect" coords="0,0,276,58" href="http://www.jnshu.com" alt="" target="_blank"/>
</map>
<div class="reveal">
<div class="slides">
<section>
<h2>Nginx负载均衡</h2>
<p></p>
<h3>java分享会</h3>
<p>分享人:程凯</p>
</section>
<section>
<p>1.背景介绍</p>
<p>2.知识剖析</p>
<p>3.常见问题</p>
<p>4.解决方案</p>
<p>5.编码实战</p>
<p>6.扩展思考</p>
<p>7.参考文献</p>
<p>8.更多讨论</p>
</section>
<section>
<h3>1.背景介绍</h3>
</section>
<section>
<p>nginx 这个轻量级、高性能的 web server 主要可以干两件事情:直接作为http server;另外一个功能就是作为反向代理服务器实现负载均</p>
</section>
<section>
<h3>2.知识剖析</h3>
</section>
<section>
<p>nginx的负载均衡的几种策略:</p>
<p>1.轮询(默认);每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。
2.weight;指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。
3.ip_hash;每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。
4.fair(第三方);按后端服务器的响应时间来分配请求,响应时间短的优先分配。
5.url_hash(第三方)按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效。 </p>
</section>
<section>
<h3>3.常见问题</h3>
</section>
<section>
<p>1.为什么要用nginx负载均衡?</p>
<p>2.nginx的优缺点?</p>
</section>
<section>
<h3>4.解决方案</h3>
</section>
<section>
<p>1.为什么要用nginx负载均衡?</p>
<p>简单来说就是为了在服务器端宕机后,不会导致整个服务不能使用,负载均衡需要在两台以上的服务器上才能实现。</p>
</section>
<section>
<p>2.nginx的优缺点?</p>
<p>优点:(1)Nginx对网络稳定性的依赖非常小,理论上能ping通就就能进行负载功能</p>
<p>(2)Nginx安装和配置比较简单,测试起来比较方便,它基本能把错误用日志打印出来</p>
<p>(3)可以承担高负载压力且稳定,在硬件不差的情况下一般能支撑几万次的并发量</p>
<p>(4)Nginx也可作为静态网页和图片服务器,这方面的性能也无对手。</p>
<p>缺点:(1)Nginx仅能支持http、https和Email协议,这样就在适用范围上面小些</p>
<p>(2)对后端服务器的健康检查,只支持通过端口来检测,不支持通过url来检测</p>
</section>
<section>
<h3>5.编码实战</h3>
</section>
<section>
<h3>6.扩展思考</h3>
</section>
<section>
<p>Session问题:
当我们确定一系列负载的服务器后,那我们的WEB站点会分布到这些服务器上。
这个时候如果采用Test2 每一次请求随机访问任何一台服务器上,这样导致你访问A服务器后,
下一次请求又突然转到B服务器上。这个时候与A服务器建立的Session,传到B站点服务器肯定是无法正常响应的。</p>
</section>
<section>
<h3>7.参考文献</h3>
<p>百度</p>
</section>
<section>
<h3>8.更多讨论</h3>
<p></p>
</section>
<section>
<h4>鸣谢</h4>
<p>感谢观看,如有出错,恳请指正</p>
<p><small>BY : 程凯</small></p>
</section>
</div>
</div>
<script src="./lib/reveal/js/head.min.js"></script>
<script src="./lib/reveal/reveal.js"></script>
<script>
// 以下为常见配置属性的默认值
// {
// controls: true, // 是否在右下角展示控制条
// progress: true, // 是否显示演示的进度条
// slideNumber: false, // 是否显示当前幻灯片的页数编号,也可以使用代码slideNumber: 'c / t' ,表示当前页/总页数。
// history: false, // 是否将每个幻灯片改变加入到浏览器的历史记录中去
// keyboard: true, // 是否启用键盘快捷键来导航
// overview: true, // 是否启用幻灯片的概览模式,可使用"Esc"或"o"键来切换概览模式
// center: true, // 是否将幻灯片垂直居中
// touch: true, // 是否在触屏设备上启用触摸滑动切换
// loop: false, // 是否循环演示
// rtl: false, // 是否将演示的方向变成RTL,即从右往左
// fragments: true, // 全局开启和关闭碎片。
// autoSlide: 0, // 两个幻灯片之间自动切换的时间间隔(毫秒),当设置成 0 的时候则禁止自动切换,该值可以被幻灯片上的 ` data-autoslide` 属性覆盖
// transition: 'default', // 切换过渡效果,有none/fade/slide/convex/concave/zoom
// transitionSpeed: 'default', // 过渡速度,default/fast/slow
// mouseWheel: true, //是否启用通过鼠标滚轮来切换幻灯片
// }
// 初始化幻灯片
Reveal.initialize({
history: true,
dependencies: [
{ src: './plugin/markdown/marked.js' },
{ src: './plugin/markdown/markdown.js' },
{ src: './plugin/notes/notes.js', async: true },
{ src: './plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>