I apologize for the trouble. The 17k pages report is a super rare case and things may not be optimized for it.
So any ways to parallelise headerfooter as well.!!
I don't know how to improve this from the top of my head. I've submitted the task to our backlog to analyze it.
https://github.com/jsreport/jsreport/issues/933