Closed TheGor1lla closed 9 months ago
Your import process or its database is likely oom killed.
resources:
limits:
cpu: 4000m
memory: 2048Mi
2 GB maximum memory is way too low.
env:
- name: THREADS
value: "20"
Especially with such a high threads setting of 20, the memory is not enough.
(You give the pod 4 virtual CPUs, but want the import to run with 20 threads? Seems odd to me.)
Increase the memory and reduce the amount of threads. The default settings with 4 threads is meant for systems with a minimum of 4 GB of memory.
With 20 threads you'd need at least about 38 GB of memory not 2 GB, and you'd need to increase the maximum connections for the database, which exceeds the default limit of 250.
Your configuration is also missing something to increase the shm size.
volumeMounts:
- name: tiles
mountPath: "/data/database/"
Small misconception on your part, because you gave the volume mount for /data/database/
the name tiles
: the tiles (image files) that are rendered later are placed at /data/tiles/
and not at /data/database/
.
Thanks for the elaborate answer! I definitely screwed up on the resources. After fixing this, it works as expected.
Do you have any recommendations on setting the shm size?
Hi everyone,
I am trying to deploy this in k8s as well. I have a very similar deployment but my pod is just restarting every time the import is complete. What am I doing wrong?
Cheers, Lena
apiVersion: apps/v1
kind: Deployment
metadata:
name: osm-tile-server
spec:
replicas: 1
selector:
matchLabels:
app: osm
template:
metadata:
labels:
app: osm
spec:
restartPolicy: Always
containers:
- args: ["import"]
env:
- name: DOWNLOAD_PBF
value: "https://download.geofabrik.de/europe/austria-latest.osm.pbf"
- name: DOWNLOAD_POLY
value: "https://download.geofabrik.de/europe/austria.poly"
#- name: THREADS
# value: "8"
image: overv/openstreetmap-tile-server
name: osm-tile-server
securityContext:
allowPrivilegeEscalation: false
resources:
limits:
cpu: 24
memory: 32769Mi
requests:
cpu: 16
memory: 32769Mi
volumeMounts:
- name: nfs-opendatacube
mountPath: /data/austria-latest.osm.pbf
subPath: austria-latest.osm.pbf
- name: database
mountPath: "/data/tiles/"
#- mountPath: /dev/shm
# name: dev-shm
volumes:
- name: nfs-opendatacube
nfs:
server: <-ip>
path: <-path->
- name: database
persistentVolumeClaim:
claimName: osm-data-volume-claim
#- emptyDir:
# medium: Memory
# sizeLimit: 192Mi
# name: dev-shm
restartPolicy: Always containers: - args: ["import"]
The import
command only needs to run once. It exits when it is finished. After it successfully completed, the image needs to be started with the run
command instead.
Your restartPolicy: Always
always starts a new pod with import
when it finishes or runs into an error (which happens when you call import
again).
restartPolicy: Always
only makes sense for the run
command, where it is running as a service that, if it fails for whatever reason, should be restarted automatically.
Hi Istador,
thanks for the quick reply. I now start the import with an initcontainer and the run command in the main pod. Everything looks good but now the pod is stuck loading parameterizaton. Do you maybe know a solution for this? Thanks!
+ sudo -u renderer renderd -f -c /etc/renderd.conf
** INFO: 17:11:26.076: Rendering daemon started
** INFO: 17:11:26.076: Initialising request_queue
** INFO: 17:11:26.076: Parsing section renderd
** INFO: 17:11:26.076: Parsing render section 0
** INFO: 17:11:26.076: Parsing section mapnik
** INFO: 17:11:26.076: Parsing section default
** INFO: 17:11:26.076: config renderd: unix socketname=/run/renderd/renderd.sock
** INFO: 17:11:26.076: config renderd: num_threads=4
** INFO: 17:11:26.076: config renderd: num_slaves=0
** INFO: 17:11:26.076: config renderd: tile_dir=/var/cache/renderd/tiles
** INFO: 17:11:26.076: config renderd: stats_file=/run/renderd/renderd.stats
** INFO: 17:11:26.076: config mapnik: plugins_dir=/usr/lib/mapnik/3.1/input
** INFO: 17:11:26.076: config mapnik: font_dir=/usr/share/fonts
** INFO: 17:11:26.076: config mapnik: font_dir_recurse=1
** INFO: 17:11:26.076: config renderd(0): Active
** INFO: 17:11:26.076: config renderd(0): unix socketname=/run/renderd/renderd.sock
** INFO: 17:11:26.076: config renderd(0): num_threads=4
** INFO: 17:11:26.076: config renderd(0): tile_dir=/var/cache/renderd/tiles
** INFO: 17:11:26.076: config renderd(0): stats_file=/run/renderd/renderd.stats
** INFO: 17:11:26.076: config map 0: name(default) file(/home/renderer/src/openstreetmap-carto/mapnik.xml) uri(/tile/) htcp() host(localhost)
** INFO: 17:11:26.076: Initialising unix server socket on /run/renderd/renderd.sock
** INFO: 17:11:26.077: Renderd is using mapnik version 3.1.0
** INFO: 17:11:26.157: Running in foreground mode...
** INFO: 17:11:26.159: Loading parameterization function for
** INFO: 17:11:26.159: Loading parameterization function for
** INFO: 17:11:26.160: Loading parameterization function for
** INFO: 17:11:26.160: Loading parameterization function for
I deployed the tile-server to my k8s instance with a dedicated "import" deployment. When running it successfully completes the processing and clustering the tables by geometry, but afterwards just finishes.
Deployment:
Testing it locally on my docker node with a seperated instance, the import continues with:
In the end the docker instance displays the map as expected, while the k8s just displays an empty map. k8s_logs.txt