The Connection Lifecycle

Because bit.io is serverless, connection lifetimes are finite. Details on the connection lifecycle are below:

Connecting

  • Free tier databases can have up to 50 simultaneous connections.
  • Pro databases can have up to 1800 simultaneous connection.

Disconnection

  • A connection with an open transaction for more than 5 minutes will be terminated (idle_in_transaction_session_timeout Postgres parameter)
  • A connection that idles for more than 5 minutes (i.e., no queries are running, etc.), will be terminated (idle_session_timeout parameter)
  • Any connection open longer than 60 minutes will terminate.

Cool down

When a database has no connections, it will "cool down" after 60 seconds. The first new connection will warm it back up. There is a ~250ms warm up for the first connection after cool down. There is no connection delay otherwise (beyond standard SSL and authentication startup logic).

Autoscaling

When a Pro database is under heavy load, it will autoscale its resources to match. During an autoscale event, connections may terminate.

High Availability and Failover

During an outage event, databases become "cold" again. Reconnecting will "warm" it back up in a zone that isn't experiencing an outage.

Connection pooling

Given the above, we recommend client-side connection pooling. Connection pools will automatically reconnect when a program needs a connection. Most programming languages support pooling. bit.io's python and node SDK have pooling built in.

🚧

Anti-patterns for connecting

Using mechanisms intended to circumvent cool downs such as creating empty keepalives or establishing unused connections may lead to throttling, disconnects, and/or additional usage fees. If you require custom connection lifecycles, contact [email protected] for our enterprise offerings.