Tell Planetiler explicitly how many CPUs it has
Its own autodetection was leaving most of a 16-core host idle (observed in production) — likely a container cgroup/JVM detection quirk. Etc.nprocessors asks the OS directly instead.
This commit is contained in:
1 parent
f09b5de6c2
commit
f5eb9a4a8d
1 file changed
+7
-1
@@ -4,6 +4,7 @@ require "uri"
|
||||
require "json"
|
||||
require "tmpdir"
|
||||
require "fileutils"
|
||||
require "etc"
|
||||
|
||||
module Maptool
|
||||
# Regenerates data/offline.pmtiles and data/terrain.pmtiles for the
|
||||
@@ -276,7 +277,12 @@ module Maptool
|
||||
# this process's working directory (the app root, so in practice
|
||||
# that's data_dir's own "sources" subdirectory) — fetched once,
|
||||
# reused by every later build.
|
||||
run_planetiler!("--osm-path=#{osm_path}", "--output=#{tmp_path}", "--download")
|
||||
# --threads: Planetiler's own core-count autodetection can come up
|
||||
# short in a container (cgroup/JVM detection quirks vary by runtime),
|
||||
# leaving most of a many-core host idle — Etc.nprocessors asks the
|
||||
# OS directly (sched_getaffinity on Linux), which correctly reflects
|
||||
# whatever's actually usable by this process even under a container.
|
||||
run_planetiler!("--osm-path=#{osm_path}", "--output=#{tmp_path}", "--download", "--threads=#{Etc.nprocessors}")
|
||||
File.rename(tmp_path, File.join(data_dir, "offline.pmtiles"))
|
||||
File.write(offline_meta_path(data_dir), JSON.generate(sources: sources.map { |s| s.slice("code", "slug", "last_modified") }))
|
||||
ensure
|
||||
|
||||
Reference in new issue
Block a user