Estimate Interval to run your Custom Timer Job

In category SharePoint | June 25, 2014

My colleague today asked me to give him a proper reason he could use to explain the client as to why his custom timer job should run on a schedulable time frame. For example, a timer job needs to run every 30 minutes. He was afraid of any challenging questions regarding the interval that the client might ask. They may challenge him why it does not need 45 minutes instead.

I had never seen such an interesting case. His question cracked my brain trying to figure out if there were any constants that could likely be used to estimate. This post is going to show you my idea on the calculation.

To ensure an acceptable performance in SharePoint server to be reached, I would need a variable named Performance Baseline.  Ideally its value should be equal to 80 percent of total memory in the machine (e.g. 8 GB). Here is the parameter

Performance Baseline (B) = Total Memory x 80% = 6.4 GB.

This basically means my good performance is if the memory is less than 6.4 GB. If B exceeds 6.4 GB then I would have to consider using Recycling feature to revoke worker process (w3wp.exe) before IIS creates a new one. At this point, I start looking to setting in Application Pool Recycle in IIS.  The recycling setting provides two types of schedule: Fixed Intervals and Memory Based Maximums.

Upon the Performance Baseline and average memory of a worker process that you can measure via Process tab in Task Manager, I would come up with the time interval in recycle setting. For example, every 1 hour, I need the worker process to be revoked so my machine can reach the Performance Baseline. For Memory Based Maximum setting, I don’t mind when the application pool gets recycled.

Back to timer job, it requires OWSTimer service to be run. It’s OWSTimer.exe in Task Manager. When this service runs, it consumes quite high memory. To capture its average memory, you should initiate your timer job many times. Let’s say X is what we need to calculate to answer the question of my colleague. Verbally every X minutes, the existing memory increases approximately the average memory of the new OWSTimer.exe.  The main objective at this point is to set X as long as the incremental memory along with other processes does not exceed Performance Baseline.

To skip other services as I assume they are rarely stopped, we have the following parameters and formula in a machine that has 8 GB memory of RAM

  • A = 60 (the recycling interval of an application pool)
  • B = 6.4 GB (8 x 80%)
  • C = (the average memory of a worker process)
  • X is interval you need to run your timer job to reach B value.
  • D =  (the average memory of aa OWSTimer.exe)

For what I have explained so far, logically X >= A x D: C

If your client asks you the same question, you would probably be able to response them quickly. Sometimes challenging questions make you more love your job.


Leave a Reply