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

Aborting rendering #117

Closed zdila closed 5 years ago

zdila commented 5 years ago

Is there a way to abort current rendering using nodejs API?

Usecases:

zdila commented 5 years ago

Duplicate of https://github.com/mapnik/node-mapnik/issues/222

talaj commented 5 years ago

In case of exporting more or less arbitrary area to PDF, there is still risk of running out of memory, causing system to kill the process. I don't see any other option currently than to do the rendering in a separate process. Possible crash would not affect the whole server and you can also kill the process when needed.

Fork is relatively fast compared to the time of rendering and can also save some memory compared to a pool of Map objects.

zdila commented 5 years ago

Thanks @talaj for your answer.

I just don't understand comment about fork/pool. Does it relate to the question somehow? :)

BTW our map rendering app now has pool of 8 workers for tile rendering. When rendering to PDF then just one extra Map instance is created for it and other potential requests for PDF are queued.

talaj commented 5 years ago

Does it relate to the question somehow?

Yes, it does. The rendering process is usually created by forking a parent process, where Map instance is already prepared. It's not needed to create the Map object again in the rendering process then, which is usually expensive. Also memory pages containing the Map object are most likely shared between those processes.