-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2257 lines (969 loc) · 92.1 KB
/
index.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
<!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Hexo, NexT" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />
<meta property="og:type" content="website">
<meta property="og:title" content="yixiang">
<meta property="og:url" content="http://yixiang.pw/index.html">
<meta property="og:site_name" content="yixiang">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="yixiang">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Pisces',
version: '5.1.2',
sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://yixiang.pw/"/>
<title>yixiang</title><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">yixiang</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
归档
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
标签
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yixiang.pw/2018/05/24/TPC-C/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="周意翔">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="yixiang">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2018/05/24/TPC-C/" itemprop="url">TPC-C硬件性能估计</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2018-05-24T22:14:06+08:00">
2018-05-24
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2018/05/24/TPC-C/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2018/05/24/TPC-C/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<blockquote>
<p><strong>注意:</strong> 我在这块没有什么经验,因为项目原因在急切之下了解了一点相关内容,这篇文章只用来记录我看过这些资料后的初步理解。</p>
</blockquote>
<p>给某公司做项目方案,对方要求添加硬件要求估计的部分,计算tpmC值。赶紧去了解了一下,这个是个比较老的概念了,网上能找到零几年的信息,不过这个对我来说是个新东西。搜索一番之后,发现国内网站上能找到的讨论比国外要多些。因为有时间要求,刚开始急着找了一些文章看了一下,感觉每个和每个说的都有点出入,干脆静下来从头梳理一下。</p>
<h3 id="TPC和tmpC是什么?"><a href="#TPC和tmpC是什么?" class="headerlink" title="TPC和tmpC是什么?"></a>TPC和tmpC是什么?</h3><p>这个概念的出处来自<a href="http://www.tpc.org" target="_blank" rel="external">TPC非盈利组织</a>,这个组织定义了一些标准用来测试硬件性能。针对不同的场景定义了不同的标准,分别编号TPC-C, TPC-E, TPC-W等等。客户要求的我们给出的tmpC值,就是TPC-C测试对应的指标值。</p>
<p>TPC官网上有这些测试的规范,但我们没时间去看具体细节。搜到<a href="ftp://ftp.hp.com/pub/c-products/servers/benchmarks/HP_ProLiant_tpcc_Overview.pdf" target="_blank" rel="external">HP的网站上一个关于TPC-C的概要介绍文档</a>,简额明要,对于快速了解一下这个概念还挺有帮助。</p>
<blockquote>
<p><strong>Performance</strong><br>tpmC (Transactions-per-Minute-C): This is the average number of new-order transactions that the system processes per minute over a minimum of a two hour period. It is important to note that only the new-order transactions (~45% of the transactions) are counted in the tpmC metric. </p>
<p><strong>Price/Performance</strong><br>$/tpmC: With every TPC-C benchmark summary there is an itemized price-sheet of all of the commercial hardware and software components of the OLTP system, including 3 years’ worth of 24x7/4-hour response time support. Price/performance is represented by the sum of this hardware, software and support pricing divided by the tpmC rate.</p>
<p><strong>System components stressed</strong><br>The TPC-C benchmark stresses most components of the database server system and is very sensitive to latency. CPU bandwidth and speed are major factors in TPC-C performance, along with the speed of the underlying system chipset. The database tables and indices benefit from large system memory (RAM) and processor cache as these components work together to reduce the latency required to fetch data for the processors. Disk I/O latency is paramount to TPC-C performance, as it is in many OLTP applications. This results in database systems attached to hundreds, sometimes thousands of disks above and beyond space requirements to reduce disk latency for random disk I/Os</p>
<p><strong>Conclusion</strong><br>The TPC-C benchmark is an ideal benchmark for measuring system OLTP performance. Simple metrics and an easily understandable workload using only 5 transactions and 9 database tables make it easy to use the TPC-C benchmark to compare systems, platforms, DBMS systems and Operating Systems. Benchmark results are audited by a third party to insure compliance with the TPC-C specification and are further reviewed by the Transaction Processing Performance Council. The TPC-C benchmark has a scalable workload from 1 processor to above 64 processors, making it the industry standard benchmark to measure system OLTP performance.</p>
</blockquote>
<p>上面是从文档中摘抄的几个片段,关键点:tpmC值的意义,TPC-C基准测试测试的是系统的那些部分。</p>
<h3 id="tpmC值从哪里来?"><a href="#tpmC值从哪里来?" class="headerlink" title="tpmC值从哪里来?"></a>tpmC值从哪里来?</h3><p>按照上面的信息,tpmC值应该是在TPC-C测试下测出来的值,客户要我们给出tpmC值预估该怎么预估,预估值干什么用?</p>
<h3 id="预估值干什么用"><a href="#预估值干什么用" class="headerlink" title="预估值干什么用?"></a>预估值干什么用?</h3><p>tpc的网站上可以查询到一些设备经过测试后的tpmC值,如果我们能给系统预估一个比较准确的tpmC值,那么这个系统需要的硬件参数就能通过对比查找,找到一个合适的参考了,这样有个相对的参考,比拍脑袋要靠谱点,心里踏实些对吧。</p>
<h3 id="那么如何预估呢?"><a href="#那么如何预估呢?" class="headerlink" title="那么如何预估呢?"></a>那么如何预估呢?</h3><p>根据tpmC值的定义,我们需要预估系统在每分钟内能够处理的“<em>新订单(new-order)</em>”事务数。这里“<em>新订单</em>”是以TPC-C规范里面定义的测试场景来说的,在这个标准场景里面,系统在处理新订单的同时,也在处理其它几种类型的事务。总之,我们要对某个系统的tpmC值进行预估,也就是预估这个系统在每分钟内能够处理的事务数。</p>
<h3 id="具体的例子"><a href="#具体的例子" class="headerlink" title="具体的例子"></a>具体的例子</h3><p>具体例子中文资料比较好找,估计国内很多软件项目方案要求写这块内容。<a href="https://www.jianshu.com/p/5589e4a8765c" target="_blank" rel="external">这里有一篇文章内容相对比较丰富</a>,看内容估计是从用友流传出来的。这篇文章的内容结构对不熟悉如何写售前硬件方案的人来说是比较有参考作用的。在文章中,预估的tpmC值被用来估计数据库服务器的CPU需求,应用服务器的CPU需求则基于数据库服务器做了个估计,另外还单独写了网络、内存方面的估计方法。</p>
<p>文章中提到一个公式:</p>
<p>$$ TPM = TASK \times 80\% \times S \times F / (T \times C) $$</p>
<p>其中:</p>
<ul>
<li><strong>TASK</strong>:为每日业务统计峰值交易量</li>
<li><strong>T</strong>:为每日峰值交易时间,假设每日80%交易量集中在每天的3小时,即180分钟内完成:T=180。</li>
<li><strong>S</strong>:为业务操作相对于标准TPC-C测试基准环境交易的复杂程度比例。由于实际的业务的复杂程度与TPC‑C标准测试中的交易存在较大的差异,根据实践用户的统计结果,每笔交易操作相比较于TPC标准测试中的每笔交易的复杂度此值可设定为20~40。</li>
<li><strong>C</strong>:为主机CPU处理余量。实际应用经验表明,一台主机服务器的CPU利用率高于80%则表明CPU的利用率过高会产生系统瓶颈,而利用率处于60%时,是处于利用率最佳状态。因此,在推算主机性能指标时,必须考虑CPU的冗余,设定C=60%。</li>
<li><strong>F</strong>:为系统未来3-5年的业务量发展冗余预留。</li>
</ul>
<p>可以看到,这个公式里面$TASK\times80\%$的部分应该是计算峰值交易时间内的交易量的;S和F只是两个经验值,用于两个不同方面的估计;T是峰值交易时间的分钟数,这样算出来的结果就是每分钟的数量;C是CPU余量,是假设CPU不能100%使用,那么系统必须要能够处理更多交易量才行。</p>
<p>整个公式的概念还是清晰的,和tpmC的定义也能匹配上,其中$80\%$这个量可以根据不同系统特点自己定义。总而言之,就是根据经验数据也好,还是瞎估计也好,先估计出来你的系统高峰使用时间长度,以及这个时间段内的事务数,然后这两个数可以计算出来每分钟事务数。然后根据你的系统相对TCP-C标准测试的复杂度,你想要CPU工作负荷和未来业务可能的增长情况,对这个事务数做一些放大。</p>
<p>网上还能搜到一些文章的公式具体形式和这个可能不太一样,不过基本原理是一致的。不过看到有些文章的案例写得不符合原理,估计是为了交差随便应付着凑出来的吧:)</p>
<p><a href="http://www.tpc.org/tpcc/results/tpcc_results.asp?print=true&orderby=tpm&sortby=desc" target="_blank" rel="external">TPC网站上有官方认可的测试结果可查</a>,不过看最新的结果在2013年,估计近年大家已经不太看重这个了?或者只是不注重TPC-C类型的测试了而已?这个东西虽然只是个参考,离实际情况应该还有很大差距,不过总归比拍脑袋感觉要那么靠谱一丢丢。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yixiang.pw/2017/10/10/Laravel-Mix-Multi-Pack/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="周意翔">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="yixiang">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/10/10/Laravel-Mix-Multi-Pack/" itemprop="url">Laravel Mix 分开打包</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-10-10T13:41:06+08:00">
2017-10-10
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/10/10/Laravel-Mix-Multi-Pack/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/10/10/Laravel-Mix-Multi-Pack/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>通常一个Web项目会包含多个端,比如至少有用户端和管理端。有些项目,我们会按照不同的端将代分拆到不同的项目中,有些项目同一端也会将前后端项目进一步拆开。不过在一些规模不大的项目或者项目初期,为了简单,我们也常常把这些各个端的代码放到一个项目中。</p>
<p>在使用Laravel进行开发时,Laravel Mix提供的前端资源打包非常方便,但默认的配置更适合一个单端的开发。例如一个简单的包含用户端和管理端的项目,我们把用户端称为site,把管理端称为admin。 我们希望用户端和管理端的前端资源打包后分别放到/public/sites和/public/admin目录下,我们可以这样配置Laravel Mix。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// webpack.mix.js</span></div><div class="line"></div><div class="line">...</div><div class="line">mix.js(<span class="string">'site.js'</span>, <span class="string">'/public/site/js/'</span>)</div><div class="line"> .scss(<span class="string">'site.scss'</span>, <span class="string">'/public/site/css/'</span>);</div><div class="line"></div><div class="line">mix.js(<span class="string">'admin.js'</span>, <span class="string">'/public/admin/js/'</span>)</div><div class="line"> .scss(<span class="string">'admin.scss'</span>, <span class="string">'/public/admin/css/'</span>);</div><div class="line">...</div></pre></td></tr></table></figure>
<p>没什么问题,利用这个配置,webpack可以帮我们正确的打包。不过很快我们可能就觉得有些不那么完美了。用户端要围绕业务设计独特的UE和UI,而管理端强调效率,因此两端使用的前端技术栈可能有所不同,使用的库类和框架也可能不同。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yixiang.pw/2017/09/27/confidence-intervals/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="周意翔">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="yixiang">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/09/27/confidence-intervals/" itemprop="url">置信区间</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-27T22:59:08+08:00">
2017-09-27
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/09/27/confidence-intervals/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/09/27/confidence-intervals/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>《Advanced Engineering Mathematics》整本书对很多基础概念讲解的很细,但对于Confidence Interval这个概念确有点不直观。书里这么定义:</p>
<p>Confidence intervals for an unknown parameter $\mu$ of some distribution (e.g., $\theta = \mu$) are intervals $\theta_1 \le \theta \le \theta_2$ that contain $\theta$, not with certainty but with a high probability $\gamma$, which we can choose (95% and 99% are popular). Such an interval is calculated from a sample. $\gamma = 95%$ means probability $1 - \gamma = 5% = \dfrac{1}{20}$ of being wrong—one of about 20 such intervals will not contain $\theta$. Instead of writing $ \theta_1 \le \theta \le \theta_2 $, we denote this more distinctly by writing</p>
<p>$$ CONF_\gamma\{\theta_1 \le \theta \le \theta_2\}.$$</p>
<p>紧接着就开始standard trick等一堆东西了。为了更直观的理解,我们整理一下这个概念是在面对什么问题时提出来的。</p>
<h1 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h1><ul>
<li><p>假设:<br> 我们通过实验,得到了一组样本值,并且我们假设这组样本是由符合某个概率分布模型的随机变量产生的。</p>
</li>
<li><p>问题:<br> 根据这组样本,如何确定这个概率分布模型的参数?</p>
</li>
</ul>
<h1 id="具化"><a href="#具化" class="headerlink" title="具化"></a>具化</h1><p>把这个问题具化一下,假设我们得到了一组样本数据,绘制一下样本数据的直方图,如下图所示。另外我们假设这个概率分布是正态分布,我们要确定一下未知参数$\mu$。<br><img src="/images/confidence_interval_p1.png" alt=""></p>
<p>通过图中可以看到,即便给定一组样本,$\mu$实际上可能是任意值,只是不同的$\mu$产生样本数据的概率大小不一样,例如图中$\mu_1$产生这组样本(直方图展示)的概率会比$\mu_2$高。</p>
<p>我们可以使用任意函数$f(sample)$对$\mu$进行估计,计算样本均值是一种方式,所有样本值相乘也可以是一种方式,只要这个$f(sample)$的值在$\mu$的取值范围内都OK。那为什么所有书上都是用样本均值来进行估计呢?应该是因为当$\mu$取值为样本均值时,产生该样本序列的概率更高,不过这个也得是从统计上来讲,对于一个具体的序列,也有可能其他形式估计的均值产生这个序列的概率更高。</p>
<h1 id="置信区间和置信水平"><a href="#置信区间和置信水平" class="headerlink" title="置信区间和置信水平"></a>置信区间和置信水平</h1><p>在给定样本的情况下$\mu$的值也成了一个随机变量,而且是一个连续随机变量。连续随机变量取某个固定值的概率是0,值落到某个区间内的概率估计更重要。置信区间(confidence interval)就是一个$\mu$的值区间,$\mu$的概率密度函数在这个区间上的积分就是置信水平(confidence level)。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yixiang.pw/2017/04/14/Learn-Words-While-Coding/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="周意翔">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="yixiang">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/04/14/Learn-Words-While-Coding/" itemprop="url">代码中的单词</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-14T09:30:56+08:00">
2017-04-14
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/开发/" itemprop="url" rel="index">
<span itemprop="name">开发</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/04/14/Learn-Words-While-Coding/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/04/14/Learn-Words-While-Coding/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h4 id="bail"><a href="#bail" class="headerlink" title="bail"></a>bail</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">Tapable.prototype.applyPluginsBailResult = <span class="function"><span class="keyword">function</span> <span class="title">applyPluginsBailResult</span>(<span class="params">name</span>) </span>{</div><div class="line"> <span class="keyword">if</span>(!<span class="keyword">this</span>._plugins[name]) <span class="keyword">return</span>;</div><div class="line"> <span class="keyword">var</span> args = <span class="built_in">Array</span>.prototype.slice.call(<span class="built_in">arguments</span>, <span class="number">1</span>);</div><div class="line"> <span class="keyword">var</span> plugins = <span class="keyword">this</span>._plugins[name];</div><div class="line"> <span class="keyword">for</span>(<span class="keyword">var</span> i = <span class="number">0</span>; i < plugins.length; i++) {</div><div class="line"> <span class="keyword">var</span> result = plugins[i].apply(<span class="keyword">this</span>, args);</div><div class="line"> <span class="keyword">if</span>(<span class="keyword">typeof</span> result !== <span class="string">"undefined"</span>) {</div><div class="line"> <span class="keyword">return</span> result;</div><div class="line"> }</div><div class="line"> }</div><div class="line">};</div></pre></td></tr></table></figure>
<figure class="highlight php"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">$this</span>->validate($request, [</div><div class="line"> <span class="string">'title'</span> => <span class="string">'bail|required|unique:posts|max:255'</span>,</div><div class="line"> <span class="string">'body'</span> => <span class="string">'required'</span>,</div><div class="line">]);</div></pre></td></tr></table></figure>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yixiang.pw/2016/09/28/Linux-Init-System/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="周意翔">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="yixiang">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/09/28/Linux-Init-System/" itemprop="url">Linux Init System</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2016-09-28T09:30:56+08:00">
2016-09-28
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/开发/" itemprop="url" rel="index">
<span itemprop="name">开发</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2016/09/28/Linux-Init-System/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2016/09/28/Linux-Init-System/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>今天安装软件,整理了一些关于init system的资料。</p>
<h1 id="Linux-Init-System"><a href="#Linux-Init-System" class="headerlink" title="Linux Init System"></a>Linux Init System</h1><ul>
<li><p><a href="https://en.wikipedia.org/wiki/Operating_system_service_management" target="_blank" rel="external">Operating system service management (Wikipedia)</a></p>
<p>不同操作系统(Linux, Unix, macOS, Android, …)采用的系统服务管理技术。</p>
</li>
<li><p><a href="https://en.wikipedia.org/wiki/Init" target="_blank" rel="external">init (Wikipedia)</a></p>
<ul>
<li><p>Research Unix-style/BSD-style</p>
<p>系统初始化时执行脚本/etc/rc控制服务启动。支持site-specific /etc/rc.local以免修改/etc/rc。后来添加模块化支持,允许在/etc/rc.d文件夹中添加脚本。/etc/rc.d中的脚本如果有启动顺序要求,在脚本内用dependency tags显式指明,系统用rcorder脚本确定它们的排序。</p>
</li>
<li><p>SysV-style</p>
<p>添加runlevels概念,系统在不同runlevels间切换时,执行启动或结束各个服务管理脚本。默认runlevels在/etc/inittab中指定。</p>
</li>
</ul>
</li>
<li><p><a href="https://bbs.archlinux.org/viewtopic.php?id=47087" target="_blank" rel="external">BSD-style vs SysV-style</a></p>
<p>BSD:</p>
<ul>
<li>Startup scripts are generally kept in /etc/rc.d/</li>
<li>A small number of files (/etc/rc.sysinit, /etc/rc.local, etc.) control the startup process</li>
</ul>
<p>Sys V:</p>
<ul>
<li>Startup scripts are generally kept in /etc/init.d/</li>
<li>There are also a number of /etc/rcX.d/ directories – one for every run-level (i.e. X represents 0 through 6 and S, so, 8 altogether)</li>
<li>The contents of each /etc/rcX.d/ directory is a collection of soft-links to scripts in /etc/init.d/</li>
<li>Each soft-link in a specific /etc/rcX.d/ directory is named so it will execute in the order of it’s alphabetical relationship to the other soft-links</li>
</ul>
<p>可以看到BSD和SysV都可以将服务启动脚本放到/etc/rc.d文件夹下。SysV将脚本软连接到不同runlevel对应的/etc/rcX.d/文件中,启动顺序通过软连接文件名确定,而BSD的启动顺序在脚本中指定。</p>
<blockquote>
<p>Example (ls -1 /etc/rc3.d/):</p>
<p>S05vbesave <– execs first</p>
<p>S10acpid</p>
<p>S10sysklogd</p>
<p>S10xserver-xorg-input-wacom</p>
<p>S11klogd</p>
<p>S12dbus</p>
<p>S12hal</p>
<p>…</p>
<p>S98usplash</p>
<p>S99acpi-support</p>
<p>S99laptop-mode</p>
<p>S99rc.local</p>
<p>S99rmnologin <– execs last</p>
<p>This example was actually 39 lines long – and just represents run-level #3. In addition, /etc/rc.local executes after the target run-level is finished doing init.<br>So, given Sys V’s complex hierarchy – spanning 8 run-levels by an average of N-number of daemons – you can probably guess why so many people rave about Arch’s BSD-style init schema ;-)</p>
</blockquote>