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
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.3k
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
620
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
180
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
110
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
複雑なState管理からの脱却
sansantech
PRO
1
150
Featured
See All Featured
Become a Pro
speakerdeck
PRO
25
5k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
How STYLIGHT went responsive
nonsquared
95
5.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Designing Experiences People Love
moore
138
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Writing Fast Ruby
sferik
627
61k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
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ͰΦϯϓϨڥΛ͏·͘׆༻ͯ͠ίετύϑΥʔϚ ϯεͷߴ͍αʔόӡ༻Λ͍ͯ͠·͢ ▸ Ձ֨ͰेੑೳΛಘΔͨΊɺ༻్ʹ߹Θ༷ͤͯʑͳ Λ͍ͯ͠·͢ ▸ ϐΫγϒͰΠϯϑϥΤϯδχΞΛืू͍ͯ͠·͢