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
大容量SSDとOpenStreetMap
Search
Taro Matsuzawa aka. btm
October 22, 2021
Technology
0
100
大容量SSDとOpenStreetMap
OpenSourceConference 2021 Online/Fallの資料です。
Taro Matsuzawa aka. btm
October 22, 2021
Tweet
Share
More Decks by Taro Matsuzawa aka. btm
See All by Taro Matsuzawa aka. btm
OpenLayers ext TypeScript declarationの開発
smellman
0
470
平成生まれのためのUNIX&IT歴 史講座 ~番外編~
smellman
2
440
掛川城の点群データをiTownsで表示しよう
smellman
0
230
そのJavascript、全部TypeScriptにしちゃえ
smellman
1
180
MapLibreとtile.openstretmap.jpで始めるベクトル地図プログラミング
smellman
1
520
国内向けタイルサーバの構築と運用について
smellman
0
1k
Python/Javascriptで読む点群
smellman
1
4.8k
日本のCommunity向け タイルサーバの現状
smellman
0
2.6k
Pythonで点群を読んでみよう
smellman
1
2.3k
Other Decks in Technology
See All in Technology
生成AIの強みと弱みを理解して、生成AIがもたらすパワーをプロダクトの価値へ繋げるために実践したこと / advance-ai-generating
cyberagentdevelopers
PRO
1
180
10分でわかるfreeeのQA
freee
1
3.4k
生成AIとAWS CDKで実現! 自社ブログレビューの効率化
ymae
2
330
Datachain会社紹介資料(2024年11月) / Company Deck
datachain
3
16k
10分でわかるfreee エンジニア向け会社説明資料
freee
18
520k
生成AIと知識グラフの相互利用に基づく文書解析
koujikozaki
1
140
新卒1年目が挑む!生成AI × マルチエージェントで実現する次世代オンボーディング / operation-ai-onboarding
cyberagentdevelopers
PRO
1
170
Fargateを使った研修の話
takesection
0
120
신뢰할 수 있는 AI 검색 엔진을 만들기 위한 Liner의 여정
huffon
0
360
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
220
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
1.1k
事業者間調整の行間を読む 調整の具体事例
sugiim
0
1.5k
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Building Applications with DynamoDB
mza
90
6.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Cult of Friendly URLs
andyhume
78
6k
Bash Introduction
62gerente
608
210k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
680
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Transcript
େ༰ྔSSDͱOpenStreetMap Taro Matsuzawa(@smellman) OpenStreetMap Foundation Japan 1
ࣗݾհ ཧۭؒܥΤϯδχΞ ຊUNIXϢʔβձձ/Ұൠࣾஂ๏ਓOSGeoຊࢧ෦ཧࣄ/Ұൠࣾஂ๏ਓΦʔ ϓϯετϦʔτϚοϓϑΝϯσʔγϣϯδϟύϯϝϯόʔ ౦ژిػେֶOB/౦ژిػେֶCySecݱੜ breakcoreΫϥελ ͱݺΕͯ·͢
ʢୀࡁΈʣ
OSSͷ׆ಈ React NativeܥϥΠϒϥϦͷվम react-native-static-server (iOSରԠ), redux-persist (ϥΠϒϥϦΛ·Δ͝ͱ TypeScriptʹॻ͖͑Δ) ͳͲ OpenMapTilesϓϩδΣΫτͷߩݙɺཧؔ։ൃ༁
ckanext-spatial (Python3ରԠ) ͳͲ ͦͷଞɺؾ͕͘··ίʔυυΩϡϝϯτΛॻ͍ͯ·͢
ࣥචྺ ͦͷଞC MagazineͷಛूɺSoftware Designͷ࿈ࡌͳͲ ݩʑFirefox(Mozilla)Λத৺ʹ׆ಈɺݱࡏཧεϚϗΞϓϦ͕ϝΠϯ
એ
FOSS4G 2021 Japan Online 12/4-5 OSSͳཧͷΠϕϯτͰ͢ ίΞσΠͱνϡʔτϦΞϧσΠͷೋؒ ։࠵ ίΞσΠ͕ൃදத৺ Youtube
LiveͰͲͳͨͰݟΔࣄ͕Ͱ͖· ͢ https://www.osgeo.jp/events/foss4g-2021/foss4g-2021-japan-online
GEOSPATIAL Hackers Program ૯লओ࠵ͷཧۭؒܥΤϯδχΞͷҭϓϩάϥϜ ࠓ݄͙Β͍͔Βืू͕։࢝͞ΕΔͱࢥ͏ͷͰཁνΣοΫ ͳ͓ɺνϡʔλʔΛΓ·͢ https://ghp.connpass.com/
ຊ
େ༰ྔSSDͱOpenStreetMap Powered by Kioxia
͜ͱͷ͡·Γ ʮɺSSDି͢ͷͰϕϯνϚʔΫهࣄΛಉਓࢽʹॻ͍ͯΈͳ͍ʁʯ
ಉਓࢽ Kioxia(چ౦ࣳϝϞϦ)͕Maker Fair Tokyo ͚ʹ࡞ͨ͠ಉਓࢽ ΠϕϯτͷΦϯϥΠϯԽʹ͍PDFͰ ແঈͰެ։ SSDͷೱ͍͕ͨ͘͞Μ ͳ͔ͥͦ͜ʹࠞͬͨ͟ https://about.kioxia.com/ja-jp/news/2021/20210930-1.html
ࠓճಉਓࢽͷݩωλΛ͢ͱ͍͏ײ͡Ͱ͢ɻ ৽࡞ϕϯνϚʔΫͪΐͬͱ͚ͩ͋Δɻ
ςʔϚ OpenStreetMapʹ͍ͭͯ ି͠ग़͠ػࡐͱ࣮ݧڥʹ͍ͭͯ ࣮ࢪͨ͠ϕϯνϚʔΫͷհ ࠓޙͷలʹ͍ͭͯ
OpenStreetMapʹ͍ͭͯ
OpenStreetMapͱ(1) ୭Ͱࣗ༝ʹਤΛॻ͘͜ͱ͕Ͱ͖Δϓ ϥοτϑΥʔϜ ཁϢʔβొ ੈքதͷਤσʔλΛ୯Ұͷσʔλϕʔ εͰಈ͔͍ͯ͠Δ
OpenStreetMapͱ(2) σʔλ node, way, relation ͷΈ߹ΘͤͰΓཱͭσʔλϕʔε σʔλͷදݱܗࣜͱͯ͠XMLΛ࠾༻͍ͯ͠Δ σʔλ ODbL ͱ͍͏ϥΠηϯεͰެ։͞Ε͍ͯΔ
༻ར༻OK ͪͳΈʹosm.orgͰϗεςΟϯά͞ΕͯΔʮը૾ʯCC BY-SA
OpenStreetMapͱ(3) ͼ͗Ͷͬͱ͞ΜΛྫʹ͢Δͱ node͕ձࣾͷPoI(Point of Interest) ดͨ͡wayͰձࣾͷܗ(Polygon)Λදݱ ඒ௨Γ(Polyline)wayͰදݱ
OpenStreetMapͱ(4) ੈքதͷσʔλ(Planet)ΛXMLͰදݱ͢Δ ͱ1.5TB ѹॖͯ͢͠Δͷ͕ී௨ Bzip2: 109GB Protocol Buffer: 60GB
Protocol Bufferʹ͍ͭͯ XMLʹ࠷దԽ͞Εͨσʔλަܗࣜ ͔ͳΓσʔλѹॖ͕Մೳ 1.5TB XML -> 60GB Protocol Buffer
࠷ۙͷVector Tile෦Protocol Bufferܗ͕ࣜத৺ ϥΠϒϥϦͳͲॆ࣮͍ͯ͠ΔͷͰOSMͷσʔλΛ͏ͳΒσʔλ༰ྔʹ ߹ΘͤͯProtocol BufferͱXMLΛ͍͚Δͱྑ͍
ି͠ग़͠ػࡐͱ࣮ݧڥʹ͍ͭͯ
ࠓճػࡐ(PC)Λ·Δ͝ͱିͯ͠Β͍·ͨ͠ɻ ͳ͓ɺࠓିͯ͠Β͍ͬͯ·͢ɻ
εϖοΫ ROG STRIX Z390-F GAMING Intel Core i7-9700F 3.00GHz (8core/8thread)
DDR4 PC4-19200 CL15 8GBx2 SSD KXD5YLN13T84 (3,840GB NVMe)
εϖοΫ(͓·͚) AMD/ATI Vega 20 Ͳ͏ߟ͑ͯήʔϛϯάϚγϯͰ͢
None
SSD KXD5YLN13T84 Kioxiaͷσʔληϯλʔ͚SSD Ұൠ༻ʹʮചΒΕ͍ͯͳ͍ʯ ͍͓ͪ͏յౖͯ͠ΒΕͳ͍ͱ͍͏ʹͳͬͯΔ .oO(͍͘Β͢ΜͩΖɺාͯ͘ฉ͚ͳ͍) https://business.kioxia.com/ja-jp/ssd/data-center-ssd/xd5.html
None
None
جຊతͳڥ Debian/Bullseyes IPΞυϨεΛݻఆԽ ͋ͱSSHͰΑ͠ͳʹ جຊίϯιʔϧͰ࡞ۀ
جຊߏ
࣮ݧڥ ࣮ՈͷRaspberry Pi͔ΒࣗʹVPNͰৗ࣌ଓ ͔ࣗΒ࣮ՈͷRaspberry PiʹϩάΠϯ Raspberry PiΛ౿Έʹ࣮ͯ͠ݧػʹϩάΠϯͯ͠ͻͨ͢Β࡞ۀ ࣮ՈͷRaspberry PiʹPrometheusΛಈ͔ͯ͠I/OΛܭଌ
None
࣮ࢪͨ͠ϕϯνϚʔΫʹ͍ͭͯ
Overpass APIͷߏங OpenStreetMapͰҰൠతʹΘΕ͍ͯΔAPI XMLͰΫΤϦΛॻ͍ͯɺXMLͰฦΛड͚Δ ؆ུԽͨ͠ܗࣜͰΫΤϦΛॻ͘Overpass Turboͱ͍͏ͷ͋Δ ͋͘·Ͱଟ͘Πϯελϯε͕͋Δͷ͕Overpass API
Πϯετʔϧ https://wiki.openstreetmap.org/wiki/Overpass_API/Installation جຊతʹ͜͜ʹ͋Δํ๏ͰOK init_osm3s.sh ͷ࣮ߦ࣌ؒΛܭଌ
݁Ռ bin/init_osm3s.sh ../data/planet-210816.osm.bz2 $DB_DIR $EXEC_DIR 107634.58s user 12608.34s system 91%
cpu 36:32:35.51 total 1.5΄ͲͰΠϯϙʔτྃ
ߟ ೖྗܗ͕ࣜbzip2ܗࣜ ѹॖΛղ͘ͷʹίετ͕͔͔ͬͯͳ͍͔ʁ εΫϦϓτΛݺΜͰbunzip2Λ࣮ߦͯ͠Δͱ͜ΖΛಛఆͯ͠ɺ1.5TBͷXML ΛಡΈࠐ·ͤͯΈͨ
݁Ռ มԽͳ͠orz ୯ҰϓϩηεͰಈ࡞͢ΔͨΊɺΠϯϙʔτϓϩηεࣗମ͕ͦͦϘτ ϧωοΫʹͳ͍ͬͯͨ ಉ͘͡500MB/sec͙Β͍ͷεϐʔυ͕ग़͍ͯͨ ·ͩ·ͩߦ͚Δͣ
imposm3ʹΑΔPostgreSQLͷσʔλೖ Imposm3ͱ͍͏ෳͷϓϩηεͰΠϯϙʔτΛߦ͏πʔϧ͕͋Δ ΠϯϙʔτઌPostgreSQL+PostGIS+hstore PostgreSQL PGTune Λར༻ͯ͠νϡʔχϯά ೖྗϑΝΠϧProtocol Bufferܗࣜ https://imposm.org/docs/imposm3/latest/
݁Ռ ./imposm import -mapping mapping.json -connection -read -write 118021.70s user
28366.90s system 387% cpu 10:29:22.71 total 10࣌ؒ30΄ͲͰΠϯϙʔτྃ
ߟ ຊͷΠϯϙʔτͱੈքͷΠϯϙʔτΛൺֱ ੈքͷํ͕ύϑΥʔϚϯεʹҧ͍͕ग़ͨʂ
ੈքͷΠϯϙʔτ ຊͷΠϯϙʔτ࠷େͰread͕400MB/ sec͕ͩͬͨɺੈքͷΠϯϙʔτͰ࠷ େ1600MB/sec·ͰύϑΥʔϚϯε͕ग़ͨ ཧͷ3/4͙Β͍·Ͱग़͍ͯΔʂ
osm2pgroutingͷϕϯνϚʔΫ pgRoutingͱ͍͏ܦ࿏୳ࡧ༻ͷϓϩάϥϜΛௐࠪ ͳ͓ɺओͳpgRoutingओʹฐ͕ࣾϝϯςφϯε͍ͯ͠·͢ ͦͦIPAͷະ౿ϓϩδΣΫτൃ https://pgrouting.org/
τϥϒϧ osm2pgrouting͕ϝϞϦϦʔΫ͕ܹ͘͠ɺσϑΥϧτͷઃఆͰ͙͢ʹམ ͪͯ͠·͏ SwapϑΝΠϧΛ512GB༻ҙͯ͠ରԠ େ༰ྔSSDͳΒͰͷ͍ํ(·ͯ
݁Ռ ຊશҬΛΠϯϙʔτͨ͠ͱ͜Ζɺܦ࿏͕ਖ਼͘͠ΠϯϙʔτͰ͖ͳ͔ͬ ͨorz ΘΓʹؔ౦ͷΤϦΞΛΠϯϙʔτ ./osm2pgrouting -d pgrouting_kanto -U osm -W
osm -c -f 603.93s user 216.84s system 22% cpu 1:00:40.31 total 1࣌ؒ΄ͲͰΠϯϙʔτྃ
ܦ࿏୳ࡧٴͼ݁Ռ ࣗసं͚ϧʔτΛܭࢉ ΠϯϙʔτγϯάϧϓϩηεͳͷͰɺ readੑೳͰ200MB/secఔ ϚϧνϓϩηεԽͨ͠Βͬͱྑ͘ ͳΓͦ͏͕ͩɺ݁ߏͦ͠͏ʼʻ
ύϑΥʔϚϯε·ͱΊ ϚϧνϓϩηεͰ͔ͭೖྗ͕େ͖͍ϑΝΠϧͷಡΈࠐΈͷ߹ʹύ ϑΥʔϚϯε͕ߴ͘ग़Δͱ͍͏݁Ռʹͳͬͨ େ༰ྔSSDͳΒੈքதͷσʔλΛͿΜճͤΔʂ
ࠓޙͷలʹ͍ͭͯ
openmaptilesͷςετ ຊͷλΠϧαʔόߏஙʹ͍ͬͯΔϓϩάϥϜΛςετ͍ͯ͠Δ ෦తʹimposm3Λར༻ ݩʑDesk mini a300ͱ͍͏ϚγϯͰ͍ͬͯͨ࡞ۀ Desk mini a300ʹ٧ΜͰΔͷRyzen 3400G
(4core/8thread)ͳͷͰൺֱର ͱͯͪ͠ΐͬͱऑ͍ https://openmaptiles.org/
ੑೳൺֱ Asia ͷൣғͷΠϯϙʔτͷൺֱ Desk mini a300: 20ఔ Kioxiaͷݕূظ: 16ఔ ୯७ʹCPUͷੑೳࠩͱࢥΘΕΔ
όʔδϣϯΞοϓ OpenmaptilesϓϩδΣΫτͷDockerϑΝΠϧ͕࠷ۙόʔδϣϯΞοϓ ૣൺֱͯ͠Έͨ
݁Ռ 2021-10-4 (kioxia) Japan: 131345 seconds (36.5࣌ؒ) 2021-10-19 (kioxia) Japan:
100535 seconds (28࣌ؒ) ࠩ: 30810ඵ=8.5࣌ؒͷੑೳ্ ϨϯλϦϯάͷੑೳ͕େ෯ʹ্͕ͬͨͱࢥΘΕΔ
࠷ۙͷٞ JsonbܗࣜͰࠃࡍԽΛ͍ͯ͠ΔͷΛΒͨ͠ΒύϑΥʔϚϯε্͕͕Δ ͷͰʁ SQLϕʔεͰ͍ͬͯΔ࡞ۀΛPythonʹஔ͖͑ͨΒͲ͏ͳΔ͔ʁ νϡʔχϯάͷͨΊͷݕূ͕ٞ͞Ε͍ͯΔ
ͦͷଞͷϓϩάϥϜ https://tilemaker.org/ OpenStreetMap Foundation (ຊՈ)Ͱݕ౼͞Ε͍ͯΔϓϩάϥϜ OpenMapTilesͷՌΛ͍ͭͭɺ৽͍͠ΠϯϙʔτͷΈΛ࡞Ζ͏ ͱ͍ͯ͠Δ ͕࣌ؒऔΕͨΒͬͪ͜ͷϕϯνϚʔΫΛऔΖ͏͔ͱࢥ͍·͢
·ͱΊ
େ༰ྔSSDͱڊେͳσʔλϕʔε૬ੑ͕ྑ͍ ͨͩ͠ɺϚϧνϓϩηεͳͷͰͳ͍ͱSSDͷੑೳ͕ੜ͔ͤͳ͍ େ༰ྔSSDເ͕͋Δ 1TBͰΓ͘Γ͢ΔͷͦΖͦΖෆໟ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠