Cron vs Rate Expressions: When to Use Which
A practical comparison of cron and rate expressions for scheduling recurring tasks, with guidance on choosing the right format for your use case.
Two Approaches to Scheduling
When setting up recurring tasks in cloud platforms and job schedulers, you typically have two options: cron expressions and rate expressions. Both define recurring schedules, but they work differently and are suited to different kinds of tasks.
Cron expressions define schedules in terms of calendar positions: “at 9 AM on weekdays” or “on the first of every month.” Rate expressions define schedules in terms of fixed intervals: “every 5 minutes” or “every 1 hour.” The choice between them depends on whether your task is time-of-day sensitive or purely interval-based.
What Are Rate Expressions?
A rate expression specifies a fixed interval between executions. The syntax is simple: a numeric value followed by a time unit. The job runs at that interval from the moment it is enabled.
rate(5 minutes) # Every 5 minutes
rate(1 hour) # Every 1 hour
rate(12 hours) # Every 12 hours
rate(1 day) # Every 1 day
rate(7 days) # Every 7 daysThe key characteristic of rate expressions is that they are interval-based, not calendar-based. A rate(1 day) schedule does not necessarily fire at midnight; it fires 24 hours after the last execution (or after the rule is first enabled). The exact time depends on when the schedule was created.
Rate Expression Syntax Rules
- The value must be a positive integer.
- Use singular form for value of 1:
rate(1 hour)notrate(1 hours). - Use plural form for values greater than 1:
rate(5 minutes)notrate(5 minute). - Supported units:
minute(s),hour(s),day(s). - Rate expressions do not support seconds, weeks, months, or years as units.
What Are Cron Expressions?
Cron expressions define schedules based on specific positions in the calendar. Instead of specifying an interval, you specify the exact minute, hour, day, month, and day of week when the task should run.
0 9 * * 1-5 # Weekdays at 9:00 AM
0 0 1 * * # First of every month at midnight
*/15 * * * * # Every 15 minutes (at :00, :15, :30, :45)
0 6,18 * * * # Twice daily at 6 AM and 6 PMThe key advantage of cron is calendar awareness. A cron expression for “weekdays at 9 AM” will always fire at 9:00 AM on Monday through Friday, regardless of when the rule was created or when the last execution occurred.
Side-by-Side Comparison
| Feature | Cron Expression | Rate Expression |
|---|---|---|
| Scheduling model | Calendar-based (specific times) | Interval-based (fixed period) |
| Complexity | 5-6 fields, many special characters | 1 value + 1 unit, very simple |
| Day-of-week support | Yes (e.g., weekdays only) | No |
| Specific time of day | Yes (e.g., 9:00 AM) | No (depends on start time) |
| Multiple times per day | Yes (e.g., 9 AM and 5 PM) | Only via interval (e.g., every 8 hours) |
| Monthly/yearly schedules | Yes | No (max unit is days) |
| Minimum interval | 1 minute | 1 minute |
| Predictable execution time | Yes (deterministic) | Relative to start (can drift) |
| Human readability | Requires learning the syntax | Self-explanatory |
When to Use Cron Expressions
Choose cron when your scheduling requirements include any of these characteristics:
- Time-of-day matters: Your task must run at a specific clock time (e.g., 9:00 AM, midnight, end of business day). Rate expressions cannot guarantee this.
- Day-of-week sensitivity: You need weekday-only schedules, weekend schedules, or specific days like “every Tuesday and Thursday.”
- Calendar-based schedules: Monthly, quarterly, or yearly tasks that must fire on specific dates (e.g., “1st of every month,” “January 1st”).
- Multiple specific times: You need a task to run at 9:00 AM, 1:00 PM, and 5:00 PM. A cron expression handles this directly with
0 9,13,17 * * *. - Business hours only: Tasks that should only execute during working hours (e.g.,
*/15 9-17 * * 1-5for every 15 minutes during business hours on weekdays). - Cross-team coordination: When other teams or systems expect events at specific times, cron ensures deterministic scheduling.
When to Use Rate Expressions
Choose rate expressions when:
- Simple fixed intervals: You need “every N minutes/hours/days” and the exact clock time does not matter (e.g., health checks every 5 minutes).
- Infrastructure monitoring: Heartbeat checks, liveness probes, and metric scraping where the interval is what matters, not the time of day.
- Queue processing: Polling a queue or message bus at regular intervals to process incoming work.
- Simplicity is a priority: When the person writing or maintaining the schedule may not be familiar with cron syntax,
rate(5 minutes)is immediately understandable. - Cache refresh: Invalidating or refreshing cached data at fixed intervals where clock alignment is unimportant.
Equivalent Expressions
Some schedules can be written in both formats. Here are common equivalents, though keep in mind that rate expressions start from when the rule is created, so the exact firing times may differ.
| Schedule | Cron | Rate | Notes |
|---|---|---|---|
| Every 5 minutes | */5 * * * * | rate(5 minutes) | Cron fires at :00, :05, :10... Rate fires relative to start. |
| Every hour | 0 * * * * | rate(1 hour) | Cron fires at :00 every hour. Rate may fire at :23, :23, etc. |
| Every day | 0 0 * * * | rate(1 day) | Cron fires at midnight. Rate fires at creation time daily. |
| Every 7 days | 0 0 * * 0 | rate(7 days) | Cron fires Sunday midnight. Rate fires 7 days after start. |
Platform-Specific Guidance
The availability and syntax of cron and rate expressions varies across cloud platforms. Here is how each major platform handles scheduling.
AWS (EventBridge / CloudWatch Events)
AWS supports both cron and rate expressions for EventBridge rules, Lambda scheduled events, and Step Functions.
# Cron (6-field format with year)
schedule_expression = "cron(0 9 ? * MON-FRI *)"
# Rate
schedule_expression = "rate(5 minutes)"
# AWS EventBridge Scheduler also supports "at()" for one-time
schedule_expression = "at(2025-03-01T09:00:00)"AWS EventBridge cron uses a non-standard format with a year field and the ? wildcard. See our dedicated AWS EventBridge Cron Guide for details.
Google Cloud Platform (Cloud Scheduler)
GCP Cloud Scheduler uses standard Unix cron format (5 fields) and supports timezone configuration. GCP does not have a separate rate expression format; all schedules use cron.
# Standard 5-field cron
gcloud scheduler jobs create http my-job \
--schedule="0 9 * * 1-5" \
--time-zone="America/New_York" \
--uri="https://example.com/api/daily-task"
# For "every 5 minutes" you still use cron
gcloud scheduler jobs create http health-check \
--schedule="*/5 * * * *" \
--uri="https://example.com/health"The notable advantage of GCP Cloud Scheduler is native timezone support. You can specify America/New_York and the scheduler handles daylight saving time transitions automatically.
Microsoft Azure (Logic Apps / Functions)
Azure supports both NCRONTAB (cron with seconds) and timer trigger expressions. Azure Functions use a 6-field cron format with seconds as the first field.
// Azure Functions host.json - NCRONTAB format (6 fields with seconds)
{
"schedule": "0 */5 * * * *" // Every 5 minutes
}
// Azure Functions also supports timer triggers
{
"schedule": "0 0 9 * * 1-5" // Weekdays at 9 AM
}
// Azure Logic Apps - Recurrence trigger (rate-like)
{
"type": "Recurrence",
"frequency": "Minute",
"interval": 5
}Azure Functions NCRONTAB adds a seconds field at the start, similar to Quartz Scheduler. Azure Logic Apps use a recurrence trigger that is functionally similar to rate expressions but with more configuration options including timezone and specific days. When working with JSON configuration files for Azure Functions or similar platforms, our JSON Formatter can help you validate and format the configuration before deployment.
GitHub Actions
GitHub Actions uses standard 5-field POSIX cron syntax. There is no rate expression option. All schedules run in UTC.
# .github/workflows/scheduled.yml
on:
schedule:
- cron: '0 9 * * 1-5' # Weekdays at 9 AM UTC
- cron: '*/15 * * * *' # Every 15 minutesGitHub Actions has a caveat: scheduled workflows may be delayed during periods of high load. The cron schedule defines the minimum interval, not a guaranteed execution time.
Kubernetes (CronJob)
Kubernetes CronJob resources use standard 5-field cron expressions. The timezone defaults to the kube-controller-manager timezone (typically UTC) but can be configured per CronJob since Kubernetes 1.25 using the timeZone field.
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-backup
spec:
schedule: "0 2 * * *" # Daily at 2 AM
timeZone: "America/Chicago" # Optional, K8s 1.25+
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: backup:latestDecision Framework
Use this quick decision tree when choosing between cron and rate:
- Does the task need to run at a specific time of day? Use cron.
- Does the task need to run only on certain days? Use cron.
- Is the schedule based on a calendar date (1st of month, quarter end)? Use cron.
- Is the schedule a simple fixed interval where clock time does not matter? Use rate.
- Is readability more important than precision? Use rate for simplicity.
- Does the platform only support cron? (GCP, GitHub Actions, Kubernetes) Use cron with interval syntax like
*/5 * * * *.
Combining Both Approaches
In practice, many systems use both cron and rate expressions for different types of tasks. A typical architecture might use:
- Rate expressions for infrastructure concerns: health checks every 1 minute, cache refresh every 5 minutes, queue polling every 30 seconds.
- Cron expressions for business logic: daily reports at 9 AM, weekly digest on Mondays, monthly billing on the 1st.
This combination gives you the simplicity of rate expressions where appropriate and the precision of cron expressions where the schedule must align with business hours or calendar dates.
Build Your Cron Expression
Ready to create a cron expression for your use case? Our Cron Expression Builder lets you construct expressions visually, see next execution times, and share them with your team. You can also type in natural language like “every weekday at 9am” and get the correct cron expression instantly.
Further Reading
- AWS rate expressions
AWS EventBridge rate expression syntax for fixed-interval scheduling.
- systemd.timer — freedesktop.org
Linux systemd timer unit documentation, a modern alternative to cron.
- Google Cloud Scheduler documentation
Google Cloud cron job scheduling with App Engine cron and unix-cron formats.