Reduce memory usage of Batch Jobs

Reduce memory usage of Batch Jobs

Hello everyone,

We have an application developed, which contains several end-of-day jobs. After starting to run the job, it does run, but it consumes more memory, and the job seems to run longer that it almost reaches the time of start of shift of the users of the application. That causes slowness from the application side.

We feel that it's all about the memory consumption of the batch jobs that causes the slowness. May I ask if there is a way to reduce memory usage of the batch jobs? If so, how?


Consuming lots of memory on a batch job is VERY rare. You'd have to be doing something pretty unusual, like retaining a LOT of data in memory. In addition, using lots of memory will NOT be the cause of slowdowns, unless you have far too little memory and it is constantly using the swap file.

Have you done any profiling of CPU usage in the database or the app servers? What about disk I/O?

If the problem really is the memory, it sounds like you would be doing far too much in your batch job (probably keeping too many records in a record list), which would mean that you need to rewrite it to be smarter. Remember, it's .NET or Java under the hood, and they are doing garbage collection on unused objects.

Are you using any extensions? Maybe they are not releasing memory until the entire job is finished?

Again, you must do full profiling here... CPU, RAM, disk I/O... on the app servers AND the DB servers... to know exactly what the cause of the slowdown is. And again, "using lots of memory" doesn't cause slowness, "using more than the physical memory you have available, and using swap file" causes slowness.