This commit is contained in:
Zsolt Ero
2023-12-15 03:47:46 +01:00
parent 578f81d320
commit 71d7d7fe95
16 changed files with 135 additions and 40 deletions

View File

@@ -0,0 +1,29 @@
local counter = 1
local lines = {}
local base_path = "/planet/20231208_091355/tiles/"
local file_path = "/data/ofm/benchmark/path_list_small.txt"
for line in io.lines(file_path) do
table.insert(lines, base_path .. line)
end
local function getNextUrl()
-- Get the next URL from the list
local url_path = lines[counter]
counter = counter + 1
-- If we've gone past the end of the list, wrap around to the start
if counter > #lines then
counter = 1
end
return url_path
end
request = function()
-- Return the request object with the current URL path
local path = getNextUrl()
local headers = {}
headers["Host"] = "ofm"
return wrk.format('GET', path, headers, nil)
end

View File

@@ -0,0 +1,5 @@
mkdir -p mnt_ro
sudo mount -v \
-t btrfs \
-o ro \
image.btrfs mnt_ro

View File

@@ -0,0 +1,17 @@
server {
server_name ofm tiles.openfreemaps.org;
# test with
# curl -H "Host: ofm" http://localhost/planet/20231208_091355/tiles/7/72/48.pbf
#access_log /data/ofm/logs/nginx-access.log access_json;
access_log off;
error_log /data/ofm/logs/nginx-error.log;
location /planet/20231208_091355 {
gzip off;
alias /data/ofm/runs/planet_20231208_091355/mnt_ro/extract;
autoindex on; # Enables listing of directory
}
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
sudo umount mnt || true
rm -rf mnt
sudo umount mnt_rw || true
rm -rf mnt_rw
rm -f image.btrfs
@@ -16,21 +16,21 @@ mkfs.btrfs -v \
# https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#mount-options
# compression doesn't make sense, data is already gzip compressed
mkdir -p mnt
mkdir -p mnt_rw
sudo mount -v \
-t btrfs \
-o noacl,nobarrier,noatime,max_inline=4096 \
image.btrfs mnt
image.btrfs mnt_rw
sudo chown ofm:ofm -R mnt
sudo chown ofm:ofm -R mnt_rw
../../tile_gen/venv/bin/python ../../tile_gen/extract.py output.mbtiles mnt/extract \
../../tile_gen/venv/bin/python ../../tile_gen/extract.py output.mbtiles mnt_rw/extract \
> "extract_out.log" 2> "extract_err.log"
sudo umount mnt
sudo umount mnt_rw
../../tile_gen/venv/bin/python ../../tile_gen/shrink_btrfs.py image.btrfs
# pigz -k image.btrfs --fast