I'm responsible for several scheduled jobs that poll a partner system for data changes. As the data volume has grown, the jobs now have two problems: they no longer fit comfortably in memory, even after vertically scaling the workers, and they cannot finish within the required 30-minute window. Increasing the time limit isn't practical because other dependent processes expect these jobs to complete on schedule. What architecture or scheduling changes would help process the larger data set reliably without exceeding the memory or runtime limits?
4 Answers
Be careful with simply adding more replicas. If every replica polls the same range, you can create duplicates, rate-limit failures, and race conditions. Use partition ownership or a work queue, store checkpoints, and make writes idempotent. Also monitor lag, chunk duration, memory usage, API rate limits, and failed partitions so you know whether the system is keeping up.
The main fix is usually to stop treating the job as one large in-memory batch. Process the data in pages or chunks, persist progress after each chunk, and make each chunk restartable and idempotent. A cursor, timestamp, or partner-provided change token is generally better than repeatedly scanning the entire data set. That keeps memory bounded and lets the work resume if a run is interrupted.
If the complete workload still cannot finish in 30 minutes, split it into multiple independent workers instead of extending the single CronJob. A scheduler or queue can dispatch partitions by customer, date range, or partner-record key, with a final aggregation step once all partitions finish. Add limits so parallel workers do not overwhelm the partner API.
First measure where the time is going. You may be able to reduce the workload substantially by using incremental polling, requesting only fields that changed, adding indexes to local queries, and avoiding repeated deserialization or duplicate processing. If the partner API only supports full exports, consider importing the export into durable storage and processing it asynchronously rather than making the CronJob do everything synchronously.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures