Executions

A background function call from your application triggers a run on the Defer Platform: an execution.

This page covers the lifecycle of an execution and the associated configurations.

 

 

 

Configuration and defaults

For information regarding maximum durations or other limits, please refer to Limits.

DefaultPossible valuesDescription
concurrency1Hobby: 1
Pro: 1-10
Specify in the background function should benefit from parallelism
retries00-15Specify how many times a failed execution should be retried
Node version1616, 18The Node version used is configured at the environment level and used for both Builds and Executions.

 

 

 

Error handling


Any error outside of a background function execution (steps 1, 2, 4, 5) would update the execution to “Failed”, without retry. In such an event, you will be notified on Slack and will be able to rerun it from the Dashboard.

Out of memory behavior

A background function execution reaching the memory limit will be stop as failed, without retry.

 

 

Concurrency

Eventually FIFO

A background function, when configured as FIFO (concurrency: 1), will be process executions one by one. However, please note that our Scheduler - at the moment - is eventually FIFO, doing best effort to respect the queueing order.

 

Concurrency account limits

Each account gets a maximum concurrency (Hobby: 1, Pro: 10) that take precedence on the configured background functions concurrency.

For example, on a Pro Plan, if 2 background functions with concurrency: 10 triggers 100 executions each, the Defer Platform will takes 5 of each concurrently, matching the account maximum concurrency (10).

 

 

Retries

When configured, Defer applies an exponential backoff (opens in a new tab) (with random jitter) retry algorithm to a failed execution:

Execution time1st retry time2nd retry time3rd retry time
importContacts()t1t2 = t1 + (16 - 36s)t3 = t2 + (31 - 61s)t4 = t3 + (96 - 136s)

This approach ensures that retries are distributed and works well for rate-limited executions.

 

 

Execution result

The value returned by a background function should be a non-null value (void is permitted).

Please note that the execution result (return value) has a maximum size limit and must be serializable.

 

 

Date and time

Background functions are executed with a UTC timezone configuration.

Please take it in consideration when writing date/time-related logic in your background functions.

 

 

 

Reserved Environment variables

The following Environment variables are reserved and will be overrided if configured on the environment's settings.

  • DEFER_TOKEN
  • NODE_ENV
  • FORCE_COLOR
  • NODE_DEBUG
  • NODE_DEBUG_NATIVE
  • NODE_DISABLE_COLORS
  • NODE_EXTRA_CA_CERTS
  • NODE_ICU_DATA
  • NODE_NO_WARNINGS
  • NODE_OPTIONS
  • NODE_PATH
  • NODE_PENDING_DEPRECATION
  • NODE_PENDING_PIPE_INSTANCES
  • NODE_PRESERVE_SYMLINKS
  • NODE_REDIRECT_WARNINGS
  • NODE_REPL_HISTORY
  • NODE_REPL_EXTERNAL_MODULE
  • NODE_SKIP_PLATFORM_CHECK
  • NODE_TLS_REJECT_UNAUTHORIZED
  • NODE_V8_COVERAGE
  • NO_COLOR
  • OPENSSL_CONF
  • SSL_CERT_DIR
  • SSL_CERT_FILE
  • UV_THREADPOOL_SIZE

NODE_ENV is set with prod value when the function runs.

 

 

 

FAQ

How Defer ensures to never loses an execution?

All queued executions are stored on disk storage - not in memory - and replicated across multiple A/Z for better reliability.

Is an execution secure?

Each execution happens in an isolated container with an allocated VPC and storage. It is not possible to communicate between executions, and each background function source is fetched securely.

How do you guarantee that executions will be processed on time?

Each function belongs to a dedicated scheduling queue, preventing abuse from a specific user. Also, our infrastructure auto-scales to ensure a reasonable processing time (see Limits).

How is a Defer execution different from an AWS Lambda one?

A Defer execution runs in a container, enabling long-running jobs (>15min) and no limitations on native dependencies.

Can my background function access the file system?

Yes; however, an execution storage is ephemeral and gets removed after the execution ends. Also, please refer to Limits for storage limitations.

Do Executions have a cold start delay?

Expect a cold start ranging from 1 to 3 seconds, depending on the number of dependencies of your project and the size of your bundled background function (with its import).