Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
用途とコスパで考えるハードウェア選びのコツ
Search
Takafumi Minamikawa
March 18, 2017
Technology
0
150
用途とコスパで考えるハードウェア選びのコツ
2017/03/17 pixiv night in Fukuoka #2 で発表した資料です
Takafumi Minamikawa
March 18, 2017
Tweet
Share
More Decks by Takafumi Minamikawa
See All by Takafumi Minamikawa
みんストのインフラを支える技術
takafumiminamikawa
0
85
pixiv-booth-riakmeetup5
takafumiminamikawa
0
130
pixiv-summer-intern2014
takafumiminamikawa
7
5.9k
Other Decks in Technology
See All in Technology
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
360
podman_update_2024-12
orimanabu
1
280
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
17
4.7k
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
400
なぜCodeceptJSを選んだか
goataka
0
160
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.5k
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
120
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
560
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
170
UI State設計とテスト方針
rmakiyama
2
640
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
170
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Faster Mobile Websites
deanohume
305
30k
Mobile First: as difficult as doing things right
swwweet
222
9k
RailsConf 2023
tenderlove
29
940
Side Projects
sachag
452
42k
A Philosophy of Restraint
colly
203
16k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Code Reviewing Like a Champion
maltzj
520
39k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Transcript
༻్ͱίεύͰߟ͑Δ ϋʔυΣΞબͼͷίπ 2017/03/17 pixiv night in Fukuoka Πϯϑϥ෦ ೆ ؽจ
ࣗݾհ ▸ ໊લ: ೆ ؽจ ▸ pixiv 6 ▸ Πϯϑϥ෦Ͱpixivͱؔ࿈αʔϏεશମͷӡ༻Λ͍ͬͯ·͢
▸ αʔόͷௐୡ͔ΒηοτΞοϓɺϛυϧΣΞͷӡ༻ɺڥߏஙɺΞϓϦέʔ γϣϯͷνϡʔχϯάɺΫϥυपΓͳͲ͍Ζ͍Ζ ▸ pixivΠϯϑϥ෦ 4ਓ͘Β͍Ͱճ͍ͯ͠Δ͏ͪͷҰਓͰ͢ ▸ ࠒιϑτΣΞΛ৮Δ͜ͱ͕ଟ͍ͷͰ͕͢ɺࠓϋʔυͷΛ͖࣋ͬͯ ·ͨ͠ ▸ pixivͰelasticsearch, RiakCS, RedisͳͲΛಛʹ৮͍ͬͯΔ͜ͱ͕ଟ͍Ͱ͢ ▸ Ruby, PHP, JavaͰίʔυΛॻ͘͜ͱ͕͋Γ·͢
QJYJWͷαʔόͨͪ ▸ ৽॓DC 200ະຬ ▸ pixiv.netΛத৺ͱͨ͠αʔό͕Քಇ ▸ ΞϓϦέʔγϣϯɺDBɺը૾ετϨʔδͳͲ ▸ നՏDC
100ະຬ ▸ ը૾ΩϟογϡαʔόΛத৺ ▸ comic.pixiv.net ͷΞϓϦέʔγϣϯɺσʔλϕʔεͳͲ ▸ ৽॓DCͱґଘ͕͍ͷΛߏங ▸ ։ൃػɺΫϥυ े ▸ ݕূ༻ͳͲظతʹ͏αʔό
Ϋϥυ ▸ ظӡ༻͠ͳ͍ɺݕূظؒݶఆΠϕϯτ༻ΞϓϦέʔγϣϯ ▸ ݕূڥΦϯϓϨΛ༻ҙ͠ͳͯ͘ेͳ͜ͱ͕͋Δ ▸ ͍҆ΦϯϓϨڥผͷ༻్ʹͬͯػձଛࣦΛ͑Δ ▸ ΦϯσϚϯυͰ༻ҙͰ͖Δར
> ΦϯϓϨ͕͔͔࣌ؒΔ ▸ όοΫΞοϓ ▸ ߋ৽ස͕͍σʔλͷόοΫΞοϓ ▸ ผڌʹΑΔԽ ▸ DCΛผڌʹ༻ҙ͢ΔΑΓ͍҆ (DNSͳͲ)
Ϋϥυ ▸ సૹྔ͕গͳ͍ ▸ ࣌ؒ vs අ༻ Ͱ࣌ؒॖͷޮՌ͕େ͖͍ͷ ▸
ϩάղੳ ▸ ظ͕ؒ͘ܭࢉ͕࣌ؒ͘ͳΔ ͔ͭ ॏཁͳࢦඪ ֎෦αʔϏ εʹ͍͛ͯ҆͜ͱ͕͋Δ ▸ ظؒɺಛʹैྔ՝ۚͷ΄͏͕҆͘ͳΔέʔεͰΫϥυΛར ༻ ▸ ΦϯϓϨظతʹ҆͘ͳΔͷͰɺϲ݄Ҏ্͏ͷɺ ظӡ༻ʹҠߦ͢Δ߹Ϋϥυ͔ΒҾ্͖͛
ΦϯϓϨαʔό ▸ αʔόߏΛߟ͑ͯઃஔ ▸ CPUɺϝϞϦɺσΟεΫIOͳͲ༻్ʹ߹ΘͤͯύʔπΛ࠷ దԽ͍ͯ͘͠ ▸ ΞϓϦέʔγϣϯ/σʔλϕʔε/ετϨʔδ Λྫʹύʔπબ ͼͷྫΛڍ͍͖͛ͯ·͢ɻ
αʔό͝ͱͷ
ΞϓϦέʔγϣϯαʔό ▸ HTTPϦΫΤετΛॲཧ͢ΔWebαʔό ▸ Apache Nginx ▸ PHP
▸ Ruby ▸ Java ͳͲ ▸ ΞϓϦέʔγϣϯͷઃܭʹ߹Θͤͯ࠷దԽ͢Δඞཁ͋Γ
ΞϓϦέʔγϣϯαʔό ▸ pixiv.net PHP(Apache + mod_php) Ͱಈ࡞ ▸
prefork (Ϛϧνϓϩηε) ▸ Apacheͷ֤ϓϩηεΛͦΕͧΕCPUίΞͰಈ͔͢ (γϯ άϧεϨουɾϚϧνϓϩηε) ▸ CPUίΞ͕ଟ͍΄͏͕ฒྻੑߴ͍
ΞϓϦέʔγϣϯαʔό ▸ BOOTH/pixivFACTORY ͳͲ Ruby (RoR) ͷαʔό ▸ nginx
+ unicorn Ͱಈ࡞ ▸ ApacheͷPreforkϞσϧͱ͍ۙ ▸ unicornMasterʹΞϓϦέʔγϣϯίʔυΛಡΈࠐΜͩ͋ͱ fork͢Δ ▸ ͚ࠩͩϝϞϦΛফඅ͢Δ CoW ͕ͩͦΕͳΓʹϝϞϦΛ͏ ▸ PHPαʔόͱൺֱͯ͠ϝϞϦ༻͕ߴ͍ͨΊϝϞϦCPUͷ ڧ͍αʔόʹ͢Δඞཁ͕͋Δ
ΞϓϦέʔγϣϯαʔό ▸ Javaαʔό ▸ SolrElasticsearchͳͲͷݕࡧΤϯδϯͰͳ͘JettyͳͲͰಈ͘Webαʔό ▸ ಡΈࠐΉσʔλগͳ͍͕ɺΞϓϦέʔγϣϯΩϟογϡΛ࣋ͭඞཁ͕͋ Δέʔε͕͋Δ ▸
ϝϞϦPHPαʔόͱಉ͡ఔͰΑ͍ ▸ εϨουΛͬͨฒྻॲཧͰCPUੑೳΛ׆͔͘͢͠CPUίΞͷଟ͍Ϛ γϯͰߴԽͰ͖Δ ▸ ϝϞϦׂΓͯΛେ͖͘͠ա͗Δͱ GC Ͱࢭ·Γ͕ͪʹͳΔ ▸ GCઓུCMSͱ͍ͨ͠ͷͰCPUੑೳ͋ͬͨ΄͏͕Α͍
σʔλϕʔεαʔό ▸ MySQL ▸ InnoDB όοϑΝϓʔϧʹଟ͘ͷσʔλΛࡌͤΔ ▸ σΟεΫͷΞΫηε͕গͳ͘ͳΔΑ͏ʹ͢Δ ▸
bin/relaylogͷॻ͖ࠐΈ͕͘ͳΒͳ͍Α͏ߴͳSSDΛ datadirʹࢦఆ ▸ ΫΤϦ͕࠷దԽ͞Ε͍ͯΕCPUੑೳͦΕ΄Ͳཁٻ͞ Εͳ͍
σʔλϕʔεαʔό ▸ Solr / Elasticsearch ▸ Javaͷӡ༻APͱࣅ͍ͯΔ ▸ σʔλͷϩʔυɺωοτϫʔΫ௨৴ɺώʔϓαΠζେ͖͍
▸ ϝϞϦׂΓͯΛେ͖͘͠ա͗Δͱ GC Ͱࢭ·Γ͕ͪʹͳΔ ▸ GCઓུCMSͱ͍ͨ͠ͷͰCPUੑೳ͋ͬͨ΄͏͕Α͍ ▸ 32GBҎ্ͷϝϞϦΛJVMͷώʔϓʹׂΓ͋ͯΔ߹ JVM ͕͏ϙΠϯλ αΠζ͕4όΠτ͔Β8όΠτʹͳΓޮ͕ѱ͘ͳΔ ▸ 1ϊʔυ͋ͨΓ32GBҎ্ͷώʔϓׂΓͯʹͳΒͳ͍Α͏ʹ͢Δ ▸ ΠϯσοΫεͷ୳ࡧʹCPUΛ͏ͷͰCPUڧ͍ͷΛ͏
σʔλϕʔεαʔό ▸ Redis ▸ ΦϯϝϞϦσʔλϕʔε ▸ CPUͷෳίΞΛར༻Ͱ͖ͳ͍ ▸ ίΞ͕ଟ͍ͷඞཁ͕ͳ͍
▸ σʔλͷΞΫηεྔʹ߹ΘͤͯCPUΛ༻ҙ ▸ ϝϞϦσʔλྔʹ߹Θͤͯ༻ҙ ▸ σʔλͷμϯϓɺϩʔυΛߴʹ͢ΔͨΊSSDΛ༻ҙ
ετϨʔδαʔό ▸ ը૾αʔό ▸ αϜωΠϧͱΦϦδφϧαΠζͷը૾ɺछྨʹΑͬͯΞΫηε ͕ҟͳΔ ▸ ΞΫηε͕ଟ͍খ͞ͳϑΝΠϧΛૉૣ͘ฦ͢ʹSSDͷΑ͏ͳ ϥϯμϜΞΫηεੑೳͷߴ͍σΟεΫΛ͏ඞཁ͕͋Δ
▸ ΦϦδφϧαΠζͷը૾ɺաڈͷΠϥετΞΫηεස͕ ͘ͳΔ͕͋ΓɺHDDͰेͳ͜ͱ͕͋Δ ▸ αΠζΞΫηεʹΑͬͯɺSSDͱHDDΛ͍͚Δ͜ͱ ͰίετύϑΥʔϚϯεΛΑ͍ͯ͘͠Δ
ετϨʔδαʔό ▸ Riak / RiakCS ▸ ࢄετϨʔδαʔό ▸ BOOTH/pixivFACTORYͳͲͷαʔϏεͰར༻
▸ Խ͞Ε͍ͯΔͷͰɺHDDΛRAID0ͰଋͶͯετϨʔδͱ͢Δ ▸ vnode୯ҐͰϝϞϦʹࡌͬͨΓɺbitcaskͷΩʔҰཡ͕ϝϞϦʹऩ ·ΔΑ͏ʹ͠ͳ͚ΕͳΒͳ͍ ▸ ϝϞϦͷཁٻσʔλαΠζʹΑͬͯ૿͑Δ ▸ ߴͳϨεϙϯεʹ͔ͳ͍͕ɺେ͖ͳϑΝΠϧΛѻ͍ ͍͢Α͏ʹͳ͍ͬͯΔ
ϋʔυΣΞͷબͼํ
ϋʔυΣΞ$16 ▸ Intel CPU Xeon E5 2600v4 Λ͏͜ͱ͕ଟ͍ ▸ ίετ
> E5 2603v4 2609v4 ▸ CPUΛΘͳ͍έʔε ▸ தύϑΥʔϚϯε > E5 2620v4 ʙ 2640v4 ▸ CPUΛ͏έʔε ▸ ߴपCPU(E5 2637v4ͳͲ) ͦΕҎ্ͷੑೳ ▸ ར༻ࠓͷͱ͜Ζͳ͠
ϋʔυΣΞϝϞϦ ▸ DDR3 ͔Β DDR4 ͷஔ్্͖͑ ▸ લ͘Β͍ϝϞϦՁ͕֨ඇৗʹ͔҆ͬͨ ▸ ݱࡏɺԁ҆ɾڙڅෆʹΑΓߴಅத
▸ ϝϞϦՁ֨ϒϨ͕େ͖͘Ձ֨ͷݟఆΊ͍͠ ▸ DBαʔόͰͷϝϞϦར༻͕ଟ͍ ▸ ۙͰ32GBϞδϡʔϧத৺Ͱར༻
ϋʔυΣΞετϨʔδ)%% ▸ ίϯγϡʔϚʔ͚SATA HDDΛଋͶΔͱίετ͍҆ ▸ ͕ग़͍ͯΔͨΊ ▸ ݕূσʔλଟ͍ͨΊࢀߟʹͳΓ͍͢ ▸ ΤϯλʔϓϥΠζϋΠΤϯυϞσϧߴՁ͕ͩੑೳ໘Ͱ༏ΕΔ͜ͱ
▸ ݕূ༻ʹগྔࢼ͢͜ͱ͋Δ͕ຊӡ༻Ͱͷར༻ࠓͷͱ͜Ζͳ͍ ▸ HGST / WesternDigital / TOSHIBA / Seagate ͳͲ͍Ζ͍Ζͳϝʔ ΧʔͷͷΛར༻ ▸ ϩοτʹΑΓނো͕ҧ͏͕Θ͔͍ͬͯΔͨΊɺϩοτ͝ͱʹӡ ༻Λ͚͍ͯΔ
ϋʔυΣΞετϨʔδ44% ▸ ίϯγϡʔϚʔ͚SATA SSDΛ͏έʔε͕΄ͱΜͲ ▸ HDDͱಉ͕͘͡ग़͍ͯΔͨΊ ▸ Ұ෦αʔό༻్͚SSDΛ͍ͬͯΔॴ͋Δ ▸ Samsung
/ Crucial / Intel ͳͲ͍Ζ͍ΖͳϝʔΧʔͷͷΛ ར༻
ϋʔυΣΞ)%%WT44% ▸ SSDΛ͏͔Ͳ͏͔IOੑೳͱهԱ༰ྔɺՁ֨໘Ͱ༏ΕΔ͔Ͳ͏͔ ▸ هԱ༰ྔ/Ձ֨Ͱ HDD > SSD SATA >
SSD m.2 ▸ ۙSSDՁ͔֨ͳΓ҆͘ͳ͍ͬͯΔ ▸ HDDେ༰ྔԽਐΜͰ͍Δ͕ɺIOੑೳ໘Ͱ͕͋Δ͜ͱ͋Δɻ ▸ γʔέϯγϟϧΞΫηε༻్ͰίετͳͨΊ࠾༻͍ͯ͠Δ ▸ SSDͰಉ͡Ͱɺେ༰ྔԽʹ߹ΘͤͯIOੑೳ্͕͍ͬͯ͘ͷ͕ཧ ▸ SATAͷੑೳݶքΛ͑ΔͨΊۙͰm.2ΠϯλʔϑΣΠεϞσϧ Λར༻ (༧ఆ)
·ͱΊ ▸ pixivͰΦϯϓϨڥΛ͏·͘׆༻ͯ͠ίετύϑΥʔϚ ϯεͷߴ͍αʔόӡ༻Λ͍ͯ͠·͢ ▸ Ձ֨ͰेੑೳΛಘΔͨΊɺ༻్ʹ߹Θ༷ͤͯʑͳ Λ͍ͯ͠·͢ ▸ ϐΫγϒͰΠϯϑϥΤϯδχΞΛืू͍ͯ͠·͢