What is Execution Duration?
The measured wall-clock time from when a job starts running to when it finishes.
Definition
Execution duration is the elapsed time between a job's start and completion, measured in seconds or milliseconds. It includes all processing time: network latency, server processing, database queries, and response transmission. Tracking duration over time reveals performance trends, helps set appropriate timeouts, and identifies degradation before it causes failures.
Simple Analogy
Like timing a runner with a stopwatch from the starting pistol to crossing the finish line โ it measures the total time the "run" took, regardless of what happened along the way.
Why It Matters
Duration trends are early warning systems. A job that normally takes 2 seconds but is now taking 15 seconds signals a problem โ perhaps a slow database query or an overloaded server. Catching this trend early lets you fix the issue before the job starts timing out or overlapping with the next scheduled run.
How to Verify
CronJobPro records execution duration for every run and displays it in the execution history. Look at duration trends over days or weeks. Set up alerts for when duration exceeds a threshold (e.g., more than double the average).
Common Mistakes
Only looking at average duration and missing occasional spikes. Not correlating duration increases with deployment or infrastructure changes. Setting timeout equal to the average duration instead of the maximum expected duration.
Best Practices
Track both average and P95/P99 execution durations. Set your timeout to at least 2x the P99 duration. Alert when duration exceeds a threshold. Investigate duration spikes promptly โ they often precede outright failures.
Documentation
Read the full docs
Try it free โFrequently Asked Questions
What is Execution Duration?
Execution duration is the elapsed time between a job's start and completion, measured in seconds or milliseconds. It includes all processing time: network latency, server processing, database queries, and response transmission. Tracking duration over time reveals performance trends, helps set appropriate timeouts, and identifies degradation before it causes failures.
Why does Execution Duration matter for cron jobs?
Duration trends are early warning systems. A job that normally takes 2 seconds but is now taking 15 seconds signals a problem โ perhaps a slow database query or an overloaded server. Catching this trend early lets you fix the issue before the job starts timing out or overlapping with the next scheduled run.
What are best practices for Execution Duration?
Track both average and P95/P99 execution durations. Set your timeout to at least 2x the P99 duration. Alert when duration exceeds a threshold. Investigate duration spikes promptly โ they often precede outright failures.
Related Terms
Timeout
The maximum time allowed for a job execution before it is forcefully terminated.
Execution
A single instance of a job running, from start to completion or failure.
Schedule Overlap
When a new job execution starts before the previous one has finished running.
Execution Latency
The delay between a job's scheduled time and when it actually begins executing.