openstreetmap/mod_tile — pull request #63 by kayrus (2013-12-27 17:08:07+00:00)
Title: Added couchbase combined storage

Hello!

Inspired by mbtiles storage I've added Couchbase storage to mod_tile (it is actually two memcached storages). One storage is bucket for meta info (path -> md5), second storage is for tiles (md5 -> binary data).

Couchbase is distributed key->value database and it supports memcached protocol.

config string should be as follows:
```
TILEDIR=couchbase:{memcached://localhost:11211,memcached://localhost:11212}
```

Default memcached storage is not suitable for metatiles. Each tile request creates metatile request and 500 rps generate 200 mb/s traffic. So I decided to store each png tile in one key to minimize traffic. Tiles / metainfo ratio is approximately 1/3.

I've also altered meta2tiles utility to convert metatile to couchbase storage.

In addition it is very simple to use nginx-lua for tile serving from couchbase.

One huge disadvantage is no possibility to update old tiles with new ones, as there is no inverted index for md5 -> path value. Actually it is possible to add third bucket for that, but the logic will become more complicated.