HTTP & Webhooksintermediate

What is Connection Timeout?

The maximum time allowed to establish a TCP connection before the attempt is abandoned.

Definition

A connection timeout is the maximum duration a client will wait for a TCP connection to be established with the server. It covers only the initial handshake โ€” not the time to send the request or receive the response (those are governed by read/write timeouts). If the server is unreachable, overloaded, or the network path is broken, the connection timeout prevents the client from waiting indefinitely. Typical values range from 5 to 30 seconds.

๐Ÿ’ก

Simple Analogy

Like waiting for someone to answer the phone โ€” if they do not pick up within a reasonable number of rings, you hang up rather than listening to it ring forever.

Why It Matters

Connection timeouts prevent cron jobs from hanging indefinitely when endpoints are unreachable. A job waiting forever for a connection ties up scheduler resources, potentially blocking other jobs. CronJobPro configures appropriate connection timeouts for all jobs, but understanding them helps you diagnose connectivity issues when jobs fail with timeout errors.

How to Verify

Check your HTTP client configuration for connection timeout settings. In CronJobPro, review your job timeout configuration. Test with an unreachable endpoint to verify the timeout fires: "curl --connect-timeout 5 https://unreachable-host.example.com" should fail after 5 seconds. Check job execution logs for "connection timeout" or "connection refused" errors.

โš ๏ธ

Common Mistakes

Confusing connection timeout with response timeout โ€” they are different phases. Setting connection timeout too long (30+ seconds), causing jobs to hang when endpoints are down. Setting it too short (1-2 seconds), causing false failures on high-latency networks. Not distinguishing timeout errors from other connection failures in error handling.

โœ…

Best Practices

Set connection timeouts between 5-15 seconds for most cron job endpoints. If your endpoint is on a slow network, increase accordingly but always set a finite value. Monitor connection timeout rates โ€” a spike indicates endpoint or network issues. Configure different timeouts for different jobs based on their endpoint characteristics.

HTTP Methods Guide

Learn about HTTP methods

Try it free โ†’

Frequently Asked Questions

What is Connection Timeout?

A connection timeout is the maximum duration a client will wait for a TCP connection to be established with the server. It covers only the initial handshake โ€” not the time to send the request or receive the response (those are governed by read/write timeouts). If the server is unreachable, overloaded, or the network path is broken, the connection timeout prevents the client from waiting indefinitely. Typical values range from 5 to 30 seconds.

Why does Connection Timeout matter for cron jobs?

Connection timeouts prevent cron jobs from hanging indefinitely when endpoints are unreachable. A job waiting forever for a connection ties up scheduler resources, potentially blocking other jobs. CronJobPro configures appropriate connection timeouts for all jobs, but understanding them helps you diagnose connectivity issues when jobs fail with timeout errors.

What are best practices for Connection Timeout?

Set connection timeouts between 5-15 seconds for most cron job endpoints. If your endpoint is on a slow network, increase accordingly but always set a finite value. Monitor connection timeout rates โ€” a spike indicates endpoint or network issues. Configure different timeouts for different jobs based on their endpoint characteristics.

Related Terms