FreemapSlovakia / freemap-mapnik

Outdoor map mainly for https://www.freemap.sk/
https://www.freemap.sk/?layers=X
Apache License 2.0
22 stars 9 forks source link

Tile server performance #324

Closed pdrhlik closed 2 months ago

pdrhlik commented 3 months ago

Hi,

First of all, thanks for such a great work. I am currently in a process of integrating this map into my project because I need my own tile server. I made everything work quite effortlessly (except for hillshading and contours, hope to make it work soon). I'm just curious about how to improve performance.

I tried increasing some Postgres values to utilize my whole server. I have a 4 CPU 3.2 GHz, 32 GB RAM setup and the rendering of new tiles seems really slow (seconds per tile). I only changed pngquantOptions and prerender to null in the config.

Do you have any recommendations? I also tried running openstreetmap-tile-server which is very easy to setup. It uses mod_tile under the hood and it seemed really fast compared to your server solution.

Thanks a lot for any advice, Patrik

zdila commented 3 months ago

You probably used openstreetmap-tile-server with their styles and DB schema.

Try to check what takes most of CPU. Is it Postgres or Node process? If Postgres then try to log slow SQL queries.

pdrhlik commented 3 months ago

Node is running at full CPU capacity all the time. Whenever I move the map to render tiles, a few postgres processes are spawned but they seem to do their work fine. Is the node process supposed to behave like this?

zdila commented 3 months ago

node process uses mapnik to render the map and mapnik executes query on postgres to get the data. It should not be that slow. MAybe try to add some measutements to the code how long does it take to tender a tile (with mapnik).

pdrhlik commented 3 months ago

I'll give it a shot and I'll let you know if I figure something out. Thanks!

pdrhlik commented 2 months ago

I eventually took a completely different approach without mapnik so I wasn't able to determine the underlying issue (if there even was one).

Thanks anyway, @zdila!