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
110
大容量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
500
平成生まれのためのUNIX&IT歴 史講座 ~番外編~
smellman
2
460
掛川城の点群データをiTownsで表示しよう
smellman
0
250
そのJavascript、全部TypeScriptにしちゃえ
smellman
1
190
MapLibreとtile.openstretmap.jpで始めるベクトル地図プログラミング
smellman
1
530
国内向けタイルサーバの構築と運用について
smellman
0
1.1k
Python/Javascriptで読む点群
smellman
1
4.8k
日本のCommunity向け タイルサーバの現状
smellman
0
2.6k
Pythonで点群を読んでみよう
smellman
1
2.4k
Other Decks in Technology
See All in Technology
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
260
なぜCodeceptJSを選んだか
goataka
0
160
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
190
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
450
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
110
Featured
See All Featured
Speed Design
sergeychernyshev
25
670
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
GraphQLとの向き合い方2022年版
quramy
44
13k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Making the Leap to Tech Lead
cromwellryan
133
9k
Building an army of robots
kneath
302
44k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Done Done
chrislema
181
16k
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ͰΓ͘Γ͢ΔͷͦΖͦΖෆໟ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠