mapnik / mapnik-support

Use the issues queue here to ask questions and offer help on using Mapnik (maybe if this works well we can retire the mailing list at http://mapnik.org/contact/?)
6 stars 6 forks source link

Suspending/resuming renderring #124

Closed zdila closed 5 years ago

zdila commented 5 years ago

Is there a way to suspend and resume rendering of a map (tile)?

Our usecase is that mapnik pre-renders all tiles using all CPU cores but during that time user can request some not-yet-prerenderred tile and that should have highest priority. In that case we would like to suspend pre-rendering of some tile and start rendering user-requested one.

Currently we only ask a mapnik instance from a pool with higher priority, but if all workers are runinng (pre-rendering) then a process must wait for a worker to finish.

We use node-mapnik.

zdila commented 5 years ago

Workaround - run 2 processes:

It is not the cleanest approach as it eats twice memory resources.

talaj commented 5 years ago

It is not the cleanest approach as it eats twice memory resources.

You can save that memory by forking the prerender process from the on-demand process once Mapnik styles are loaded. In such case all read-only memory will be shared between those processes in Linux.

zdila commented 5 years ago

I can fork in nodejs but I am afraid I can't set the fork nice level.

talaj commented 5 years ago

It should be possible to set nice of a process at any time.

zdila commented 5 years ago

I couldn't find such API in nodejs. Just fork.

zdila commented 5 years ago

But still stopping and resuming mapnik instance would keep it's memory allocated so my workaround is not any worse and it already works :)