Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Nov 12, 2024
1 parent 0148328 commit 09f7585
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
21 changes: 21 additions & 0 deletions guides/clustering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Clustering

Oban supports running in clusters of nodes. It supports both nodes that are connected to each
other (via *distributed Erlang*), as well as nodes that are not connected to each other but that
communicate via the database's pub/sub mechanism.

Usually, scheduled job management operates in **global mode** and notifies queues of available
jobs via pub/sub to minimize database load. However, when pub/sub isn't available, staging
switches to a **local mode** where each queue polls independently.

Local mode is less efficient and will only happen if you're running in an environment where
neither PostgreSQL nor PG notifications work. That situation should be rare and limited to the
following conditions:

1. Running with a connection pooler, like [pg_bouncer], in transaction mode.
2. Running without clustering, that is, without *distributed Erlang*.

If **both** of those criteria apply and pub/sub notifications won't work, then
staging will switch to polling in local mode.

[pg_bouncer]: http://www.pgbouncer.org
19 changes: 2 additions & 17 deletions guides/scheduling_jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,5 @@ scheduling:
|> Oban.insert()
```

## Caveats & Guidelines

Usually, scheduled job management operates in **global mode** and notifies queues of available
jobs via Pub/Sub to minimize database load. However, when Pub/Sub isn't available, staging
switches to a **local mode** where each queue polls independently.

Local mode is less efficient and will only happen if you're running in an environment where
neither PostgreSQL nor PG notifications work. That situation should be rare and limited to the
following conditions:

1. Running with a connection pooler, like [pg_bouncer], in transaction mode.
2. Running without clustering, that is, without *distributed Erlang*.

If **both** of those criteria apply and Pub/Sub notifications won't work, then
staging will switch to polling in local mode.

[pg_bouncer]: http://www.pgbouncer.org
Scheduling works across a cluster of nodes. See the [*Clustering* guide](clustering.html) for more
information.
2 changes: 2 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ defmodule Oban.MixProject do
"guides/operational_maintenance.md",
"guides/writing_plugins.md",
"guides/periodic_jobs.md",
"guides/clustering.md",
"guides/sqlite3.md",

# Upgrading
"guides/upgrading/v2.0.md",
Expand Down

0 comments on commit 09f7585

Please sign in to comment.