0
0

LMDBでnosyncすると速くなった

Posted at

背景

Kontur Population PMTiles (optgeo/kpop-pmtiles)というプロダクトを作りにあたって、H3のresolutionを変えながらデータベースに値を記録していくということを行いました。

わかったこと

過去の経験から、LMDBを使っていたのですが、LMDB.newする際に :nosync => true を付加すると高速になることがわかりました。

require 'lmdb'

$env = LMDB.new('db', 
  :nosync => true, :nometasync => true, 
  :writemap => true, :mapasync => true, 
  :mapsize => 5000 * 1024 * 1024 * 1024
)
$db = $env.database

データベースファイルは USB 接続された HDD に作成していたのですが、nosync を true にする前には 300 records/s くらいだったところ、nosync を true にした後は 3000 records/s を超える速度を出せていたようです。

関係ファイル

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0