While processing chunks of 200 ledgers, we've identified that some data structures take more than 100 MB if we store data of all those ledger transactions in the memory.
Using cache should allow us to decrease that memory usage by a lot and potentially reduce the processing time.
This needs some tests and investigation