Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min/maxRendererPoolSizes in config have no effect #1072

Open
geoneutrino opened this issue Nov 23, 2023 · 8 comments
Open

min/maxRendererPoolSizes in config have no effect #1072

geoneutrino opened this issue Nov 23, 2023 · 8 comments

Comments

@geoneutrino
Copy link

geoneutrino commented Nov 23, 2023

I'm using docker, tileserver version 4.6.5 and am serving vector and raster
Investigating slow raster performance i saw in htop that max 4 cpu cores are used. Changing min/maxRendererPoolSizes don't have an effect on this, no matter what i enter as value. Changing other options like maxScaleFactor increase from 3 to 4 works, only the renderers seem to use defaults
(also changing docker runtime like "docker update --cpus 8 containerid" doesn't do any difference)
It seems that the config options doesn't get to
https://github.com/maptiler/tileserver-gl/blob/master/src/serve_rendered.js#L1604C36-L1604C56

What am i missing ?

my config.json
{
"options": {
"paths": {
"fonts": "fonts",
"styles": "styles",
"sprites": "sprites",
"mbtiles": ""
},
"maxScaleFactor": 3,
"maxSize": 2048,
"minRendererPoolSizes": [16,8,8],
"maxRendererPoolSizes": [32,16,8],
"tileMargin": 30
},
"styles": {
...

@geoneutrino
Copy link
Author

geoneutrino commented Nov 28, 2023

Update: same effect when using source direct without docker
console.logging the values in serve_rendered i see the pool is created with the adjusted value
But in static rendering complex raster tiles i still see only 4 cpu cores used in htop

@acalcutt
Copy link
Collaborator

acalcutt commented Nov 28, 2023

I tested the current code a bit yesterday and like you said it does seem to pass those values on... I'm not sure why it would still be limited to 4 cpu though.

@acalcutt
Copy link
Collaborator

acalcutt commented Dec 1, 2023

Could it be related to UV_THREADPOOL_SIZE https://github.com/maptiler/tileserver-gl/blob/master/src/server.js#L5 you think?

@geoneutrino
Copy link
Author

i have narrowed it down to maplibre native
https://github.com/maplibre/maplibre-native/blob/main/ARCHITECTURE.md
=> "This work happens on "worker threads" that are spawned by the main thread, four per Style object. The Style and its associated objects handle dispatching tasks to the workers, typically on a tile-by-tile basis."

so, ok, our data and style was not well optimized and with changes to both we could improve performance notably

From a DevOps perspective then the "issue" remaining is a bit the question how to optimise the system for high load scenarios to fit your hardware as we seem to have
min/maxRenderPoolSizes created by tileserver (not having the impact i expected first)
Node.js UV_THREADPOOL_SIZE alsways set to cpu * 1.5 regardless of RenderPoolSizes
and maplibre-natives 4 threads limit of style regardless of hardware ressources

@geoneutrino
Copy link
Author

at least we could add some hint this into documentation

@acalcutt
Copy link
Collaborator

acalcutt commented Dec 6, 2023

Looking for information on UV_THREADPOOL_SIZE I found this 2020 thread #489 that indicates maybe it isn't working and setting it externally or moving this code to main.js could help

@acalcutt
Copy link
Collaborator

Did you ever get a chance to see if setting UV_THREADPOOL_SIZE environment variable elsewhere helped at all?

@geoneutrino
Copy link
Author

Sorry for the late reply, as we changed data last year to optimize all it was harder to reproduce. But with release 4.10s Raster 512px its easier to test the effect as those are slower than the 256px. Long story short

  1. the effect is still the same after changing code. So its the "four threads per style" of maplibre-native i mentioned in min/maxRendererPoolSizes in config have no effect #1072 (comment)
    Not tileserver-gl issue but we can mention it in documentation

  2. as far as i understand @vcabbage in UV_THREADPOOL_SIZE may not be taking effect  #489 moving the code from server.js to main.js should still be done to work correctly (and also check if already set before overwritung as he mentions)
    Especially when hosting multiple map styles then maplibre-nativ would create 4 threads per style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants