annotate slides/master.html @ 73:7c3503a9bfcf

fix
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Thu, 13 Feb 2014 13:36:41 +0900
parents c119afd8e948
children 68e21fa11919
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 <!DOCTYPE html>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 <!--
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 Google HTML5 slide template
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 Authors: Luke Mahé (code)
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 Marcin Wichary (code and design)
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 Dominic Mazzoni (browser compatibility)
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 Charles Chen (ChromeVox support)
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 URL: http://code.google.com/p/html5slides/
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 -->
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 <html>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 <head>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 <title>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 関数型言語 Haskell による並列データベースの実装
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 </title>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <meta charset='utf-8'>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 <script
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 src='http://web.amothic.com/html5slides/slides.js'></script>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 </head>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 <style>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 /* Your individual styles here, or just use inline styles if that’s
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 what you want. */
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 </style>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 <body style='display: none'>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 <section class='slides layout-regular template-concurrency'>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 <!-- Your slides (<article>s) go here. Delete or comment out the
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 slides below. -->
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
40 <article>
70
kono
parents: 69
diff changeset
41 <h1> 関数型言語 Haskell による並列データベースの実装 </h1>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
42 <p> Daichi TOMA <br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
43 Feb 12, 2014 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
44 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
70
kono
parents: 69
diff changeset
46 <article>
kono
parents: 69
diff changeset
47 <h3> 研究概要 </h3>
kono
parents: 69
diff changeset
48 <p> Haskell を用いて信頼性の高い並列データベースを実装した </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
49 <p> Haskell は rpar により並列実行を指示し、STMにより共有データを実現する</p>
70
kono
parents: 69
diff changeset
50 <p> Haskellの並列処理は、最新のコンパイラで性能がでることがわかった</p>
kono
parents: 69
diff changeset
51 <p> 読み込みに関して 12 コアで実行した場合、10.37 倍 という性能向上率が確認できた </p>
kono
parents: 69
diff changeset
52 <p> Web 掲示板サービスを開発し、Java と比較して読み込みで 3.25 倍、書き込みで 3.78 倍の性能差が確認できた </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
53 <p> Network の並列性能はあまり出てないことがわかった</p>
70
kono
parents: 69
diff changeset
54 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
70
kono
parents: 69
diff changeset
56 <article>
kono
parents: 69
diff changeset
57 <h3> Haskellによる信頼性の高いサービスの構築</h3>
kono
parents: 69
diff changeset
58 <p> Web サービスの脆弱性を悪用されると多大な被害がでる </p>
kono
parents: 69
diff changeset
59 <p> 脆弱性の大半はBuffer Overflowや、Cross site scripting、SQL injection </p>
kono
parents: 69
diff changeset
60 <p> これらは型エラー。Haskell は、これらをコンパイル時にチェック</p>
kono
parents: 69
diff changeset
61 <p> 入力として受け取った文字列が、HTML型に実行時に自動変換されたりしない<br>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
62 ⇒ Cross site scripting が防げる </p>
70
kono
parents: 69
diff changeset
63 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
70
kono
parents: 69
diff changeset
65 <article>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
66 <h3> Haskellの型検査の例(list) </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
67 <p> : はlistに要素を追加するための演算子 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
68 <p> 1 : 2 : 3 : [] == [1,2,3] </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
69 <br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
70 <div align="center">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
71 <img src="images/list.png" width="200px">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
72 </div>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
73 <pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
74 let a = 0 : [1,2,3] -- [0,1,2,3]
70
kono
parents: 69
diff changeset
75 let b = 'a' : [1,2,3] -- error
kono
parents: 69
diff changeset
76 let c = 1 : ['a','b','c'] -- error
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
77 </pre>
70
kono
parents: 69
diff changeset
78 </article>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
79
70
kono
parents: 69
diff changeset
80 <article>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
81 <h3> 型推論 </h3>
70
kono
parents: 69
diff changeset
82 <p> 前提として関数に以下のような型が定義されているとする </p>
46
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
83 <pre>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
84 getNode :: Node -&gt; Path -&gt; Node
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
85 elems :: Map k a -&gt; [a]
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
86 children :: Node -&gt; Map Int Node
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
87 </pre>
70
kono
parents: 69
diff changeset
88 <p> 新しくgetChildrenという関数を定義する</p>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
89 <pre>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
90 getChildren node path = elems (children (getNode node path))
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
91 </pre>
70
kono
parents: 69
diff changeset
92 <p> 型をHaskellが自動で導出する </p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
93 <pre>
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
94 *Jungle&gt; :type getChildren
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
95 getChildren :: Node -&gt; Path -&gt; [Node]
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
96 </pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
97 </article>
46
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
98
70
kono
parents: 69
diff changeset
99 <article>
kono
parents: 69
diff changeset
100 <h3> 実用的なデータベースには並列実行が必須 </h3>
kono
parents: 69
diff changeset
101 <p> 現在、CPU はマルチコア化がすすんでいる </p>
kono
parents: 69
diff changeset
102 <p> 実用的なデータベースとするためにはマルチコアに対応させる必要性がある </p>
kono
parents: 69
diff changeset
103 <p> 並列に処理できればマルチコアで性能が出る </p>
kono
parents: 69
diff changeset
104 <p> Haskell は Eval モナド(rpar)といったモナドで並列実行の機能を提供</p>
kono
parents: 69
diff changeset
105 <p> モナドは、Haskellでメタ計算を提供する構文あるいはAPI</p>
kono
parents: 69
diff changeset
106 <p> システムコールのようなものと考えてよい</p>
kono
parents: 69
diff changeset
107 <p> モナドの例:IOモナド、エラーモナド、STMモナド </p>
kono
parents: 69
diff changeset
108 </article>
46
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
109
72
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
110 <article>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
111 <h3> Haskell の並列処理 </h3>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
112 <p> sumという1つ目の引数から2つ目の引数までの全ての数を足す関数があるとする </p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
113 <p> rpar の引数にすることで関数が並列に実行可能であることを示せる </p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
114 <p> do ~ returnで rpar を 1 つにまとめ、runEvalに渡すことで実行する </p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
115 <pre>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
116 main = print (runEval test)
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
117
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
118 test = do
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
119 a &lt;- rpar (sum 0 10000)
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
120 b &lt;- rpar (sum 10000 20000)
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
121 return (a,b)
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
122 </pre>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
123 <p> a と b が並列に計算される</p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
124 </article>
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
125
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
126 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
127 <h3> Haskell の遅延評価 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
128 <p> 並列実行は遅延評価が問題になる </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
129 <p> haskell では値が必要となるまで式の評価が行われない </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
130 <p> 並列に実行するように指示しても、評価が行われなければ並列に動かない </p>
72
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
131 <p> さきほどの例ではprintを行うようにしていた</p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
132 <pre>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
133 main = print (runEval test)
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
134 </pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
135 </article>
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
136
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
137 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
138 <h3> Haskell の遅延評価 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
139 <p> sprintは評価を行わずに値を表示するコマンド </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
140 <p> _ は未評価の式を表し、thunk と呼ばれる </p>
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
141 <pre>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
142 ghci&gt; let y = map (+1) [1,2,3] :: [Int]
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
143 ghci&gt; :sprint y
69
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 68
diff changeset
144 y = _
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
145 ghci&gt; length y
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
146 3
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
147 ghci&gt; :sprint y
69
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 68
diff changeset
148 y = [_,_,_]
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
149 ghci&gt; head y
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
150 2
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
151 ghci&gt; :sprint y
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
152 y = [2,_,_]
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
153 </pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
154 <p> 並列実行時には出力などを挟んで強制的に即時評価されるようにする </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
155 </article>
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
156
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
157 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
158 <h3> データベースの設計 - 非破壊的木構造 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
159 <p> マルチコア上で、データベースの性能向上をさせるためには、各コアからデータに同時にアクセスできるようにする </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
160 <p> 非破壊的木構造という手法を用いる。</p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
161 <p> 非破壊的木構造は、元となる木構造を書き換えずに編集できる。 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
162 <p> 既にあるデータを変更しないので、データの競合状態が発生しない。並列に読み書きできる </p>
46
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
163 <br>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 <div align="center">
46
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
165 <img src="images/concurrent_edit.png" width="400px">
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 </div>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 </article>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168
70
kono
parents: 69
diff changeset
169 <article>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
170 <h3> Haskell でのRoot Node の管理 </h3>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
172 <p> Root Node は最新のNode → 状態を持つ</p>
70
kono
parents: 69
diff changeset
173 <p> 共有された状態を作るには Software Transactional Memory (STM) を使う </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
174 <p> STM は、Non-Blockingで共有データを扱える </p>
70
kono
parents: 69
diff changeset
175 <p> 共有データの変更は以下の様に行われる </p>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 <ul>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
177 <li>他から変更がなければそのまま適用
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
178 <li>変更している間に、他から変更されれば変更処理をやり直し
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 </ul>
70
kono
parents: 69
diff changeset
180 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
182 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
183 <h3> 非破壊的木構造データベース Jungle </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
184 <p> 非破壊的木構造を扱うデータベース Jungle を開発した </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
185 <p> Jungle の基本的な使い方 </p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
186 <ul>
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
187 <li> 木構造を保持する Jungle を作成
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
188 <li> Jungle に新しい木を作成
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
189 <li> 木からRoot Nodeを取ってきて、データを参照
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
190 <li> もしくは、Node を編集し、木のRoot Nodeを更新
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
191 </ul>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
192 </article>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
193
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
194 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
195 <h3> 木構造を保持する Jungle の作成 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
196 <p> 各スレッドから新しく木を作ったりできるように木構造の保持にSTMを使っている </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
197 <p> Jungle は複数の Tree を名前で管理する </p>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 <div align="center">
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
199 <img src="images/jungle_type.png" width="500px">
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 </div>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
201 </article>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
202
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
203 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
204 <h3> 木からRoot Nodeを取ってくる </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
205 <p> 木からRoot Nodeを取ってくるにはgetRootNodeという関数を使う </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
206 <p> 内部でSTMを使っているのでIOモナドを返す</p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
207 <pre>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
208 getRootNode :: Jungle -&gt; String -&gt; IO Node
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
209 </pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
210 <p> Jungleと木の名前を渡すと最新の Node が返ってくる </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
211 </article>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
212
70
kono
parents: 69
diff changeset
213 <article>
73
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
214 <h3> Jungle の最も基本的なデータ構造 Node </h3>
70
kono
parents: 69
diff changeset
215 <p> Node はChildren(Node)とattributesを持つ </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
216 <p> Jungle の参照や変更の関数は全て Node に対して行う </p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
217 <div align="center">
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
218 <img src="images/node_component.png" width="500px">
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
219 </div>
70
kono
parents: 69
diff changeset
220 </article>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
221
70
kono
parents: 69
diff changeset
222 <article>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
223 <h3> Node を編集し、木の Root Node を更新する </h3>
70
kono
parents: 69
diff changeset
224 <p> updateRootNodeやupdateRootNodeWithで更新できる </p>
kono
parents: 69
diff changeset
225 <p> 内部でSTMを使っているのでIOモナドを返す</p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
226 <pre>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
227 updateRootNode :: Jungle -&gt; String -&gt; Node -&gt; IO ()
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
228 updateRootNodeWith :: (Node -&gt; Node) -&gt; Jungle -&gt; String -&gt; IO ()
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
229 </pre>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
230 <p> updateRootNodeには編集したNodeを渡すことで木の Root Node を更新できる </p>
73
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
231 <p> updateRootNodeWithにはNodeを編集する関数 (Node -&gt; Node) を渡すことで木の Root Node を更新できる </p>
70
kono
parents: 69
diff changeset
232 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
234 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
235 <h3> 性能計測 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
236 <p> Jungle がマルチコアプロセッサで性能が出るのか、実用的なWebサービスが提供できるのか確認する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
237 <p> 性能の計測に用いるサーバの仕様 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
238 <p> ハイパースレッディングで24コアまで使える<br> ハイパースレッディングはおよそ20%程度クロックあたりの性能が向上する </p>
33
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
239 <table>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
240 <tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
241 <th>名前</th>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
242 <th>概要</th>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
243 </tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
244 <tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
245 <td>CPU</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
246 <td>Intel(R) Xeon(R) CPU X5650@2.67GHz * 2</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
247 </tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
248 <tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
249 <td>コア数</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
250 <td>12</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
251 </tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
252 <tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
253 <td>メインメモリ</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
254 <td>126 GB</td>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
255 </tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
256 <tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
257 <td>OS</td>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
258 <td>Fedora 19</td>
33
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
259 </tr>
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
260 </table>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
261 </article>
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
263 <article class="smaller">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
264 <h3> Haskell コンパイラ </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
265 <p> Haskell のコンパイラには The Glasgow Haskell Compiler (GHC) を利用する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
266 <p> 現在の GHC の安定版 7.6.3 は並列時にIOマネージャーがスケールしないという問題がある </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
267 <p> リリース候補版である 7.8 を用いることにより、よりよい性能を得ることができた </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
268 <div align="center">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
269 <img src="images/ghc.png" width="600px">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
270 </div>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
271 </article>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
272
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
273 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
274 <h3> 親和性機能(affinity)を利用する </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
275 <p> 親和性機能とは OS スレッドをCPUコアに固定する機能 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
276 <p> 並列実行時の性能が向上するため性能計測で利用する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
277 <p> Haskell は実行時に -qa オプションを使うこと親和性機能を使うように指示できる </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
278 </article>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
279
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
280 <article class="smaller">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
281 <h3> 読み込みの性能計測 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
282 <p> 木構造の読み込みにかかる時間を計測する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
283 <p> 12 スレッドで親和性機能を使って実行した場合 10.37 倍の性能向上<br>
73
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
284 →実コア数である12コアまで、ほぼ線形にスケールする</p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
285 <p> 親和性機能を使った時 24スレッドで実行すると実行時間が大幅に伸びる </p>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
286 <div align="center">
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
287 <img src="images/read.png" width="600px">
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
288 </div>
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
289 </article>
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
290
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
291 <article class="smaller">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
292 <h3> 書き込みの性能計測 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
293 <p> 木構造の書き込みにかかる時間を計測する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
294 <p> 12 スレッドで親和性機能を使って実行した場合 3.82 倍の性能向上<br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
295 → 同時に書き込みがあった場合、STMが処理をやり直すため並列度がでない</p>
73
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
296 <p> 読み込みと同様に、親和性機能を使って24スレッドで実行すると実行時間が大幅に伸びる </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
297 <div align="center">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
298 <img src="images/write.png" width="600px">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
299 </div>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
300 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
301
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
302 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
303 <h3> 読み込みと書き込みの考察 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
304 <p> 読み込みが高速 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
305 <p> 書き込みは、同時に書き込まれた場合 STMが処理のやり直しをするため、並列度がでない </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
306 <p> 親和性機能を使った場合 24 スレッドでは遅くなる<br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
307 ⇒ 全てのCPUコアにスレッドを固定することになりスケジューリングがうまくいかないためだと考えられる
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
308 <p> 書き込みより読み込みが多用されるシステムに向いている </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
309 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
310
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
311 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
312 <h3> Webサービスに組み込んでの性能計測 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
313 <p> Haskell の HTTP サーバ Warp と組み合わせて Web掲示板サービスを開発する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
314 <p> 測定ツール weighttp を用いて掲示板に読み込みと書き込みで負荷をかける。 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
315 <p> Warp は、ハイパースレッディングで明らかに遅くなるので使わない </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
316 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
317
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
318 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
319 <h3> ネットワークのボトルネック </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
320 <p> ネットワークのボトルネックが大きい </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
321 <p> 並列環境でどのようにスケールするか計測したいため、ネットワークを介さずに性能計測を行う </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
322 <br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
323 <div align="center">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
324 <img src="images/request.png" width="300px">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
325 </div>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
326 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
327
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
328
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
329 <article class="smaller">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
330 <h3> Webサービスに組み込んでの性能計測 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
331 <p> 読み込みと書き込みの実験結果 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
332 <p> 1秒間あたりどれだけリクエストを捌けるかという指標で比較<br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
333 ⇒大きければ大きいほど性能が良い </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
334 <p> 8 スレッドで実行時、読み込みは 6.18 倍、書き込みは3.93倍の性能向上 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
335 <p> Jungle 単体での実験結果と同じで、読み込みのほうがスケールする </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
336 <div align="center">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
337 <img src="images/bbs.png" width="600px">
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
338 </div>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
339 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
340
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
341 <article>
73
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
342 <h3> Java との性能比較 </h3>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
343 <p> HaskellとJavaで同様のWeb掲示板サービスを用意する </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
344 <p> 実環境を想定して、ブレードサーバ2台用意し、ネットワークを介して負荷をかける </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
345 <p> 100 万リクエストを処理するのにかかる時間を計測 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
346
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
347 <table>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
348 <tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
349 <th>測定
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
350 <th>Haskell
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
351 <th>Java
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
352 </tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
353 <tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
354 <td>読み込み
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
355 <td>16.31 s
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
356 <td>53.13 s
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
357 </tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
358 <tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
359 <td>書き込み
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
360 <td>20.17 s
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
361 <td>76.4 s
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
362 </tr>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
363 </table>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
364
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
365 <p> 読み込みで 3.25 倍、書き込みで 3.78 倍の性能差<br>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
366 ⇒ Haskell は実用的なWebサービスを開発できる </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
367 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
368
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
369 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
370 <h3> Java との生産性の比較</h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
371 <p> Haskell 版 Jungle は 284 行、Java 版 Jungle は 3,390 行 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
372 <p> 実装が 1/12 程度のサイズとなっている </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
373 <p> 再帰的なデータ型の定義ができることや、関数の再利用が行いやすいことが要因 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
374 <p> 同じ機能を実装する場合でも、Haskell は Java と比較してコード行数が短くなる </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
375 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
376
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
377 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
378 <h3> まとめ </h3>
72
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
379 <p> Haskell を用いて信頼性の高い並列データベースの実装した </p>
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
380 <p> Haskell の並列処理は、最新のコンパイラで性能がでることがわかった </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
381 <p> 読み込みに関して 12 コアで実行した場合、10.37 倍 という性能向上率が確認できた </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
382 <p> また、Web 掲示板サービスを開発し、Java と比較して読み込みで 3.25 倍、書き込みで 3.78 倍の性能が確認できた </p>
72
c119afd8e948 describe rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 71
diff changeset
383 <p> Network 越しの計測では並列性能があまり出ていないことがわかった </p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
384 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
385
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
386 <article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
387 <h3> 今後の課題 </h3>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
388 <p> 書き込み処理の性能向上 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
389 <p> 分散データベースとしての実装 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
390 <p> 永続性の実装 </p>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
391 </article>
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
392
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
393 <article>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
394 <h3>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
395 ネットワークボトルネックの計測
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
396 </h3>
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
397 <p>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
398 ネットワークを介す場合と介さない場合のWarpのベンチマーク
33
705c29dd2f6d add read benchmark
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
399 </p>
66
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
400 <div align="center">
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
401 <img src="images/warp.png" width="600px">
7c7afe38c9d6 rewrite slides
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 46
diff changeset
402 </div>
71
98a55a935619 describe slides without rpar
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
403 </article>
43
aa6de0f67a0a add files
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
404
68
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 67
diff changeset
405
31
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 </body>
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 </html>