Skip to content

Better handling of thundering herd connection problem #8

@kevinlang

Description

@kevinlang

Right now we hook into the :configure function we handle off to DBConnection.child_spec to sleep a random time between 0-50ms. But that randomness can "fail" and we can still hit a "database is locked" issue if two processes both roll the same die.

A better solution is to use the :pool_index option provided to us then to more evenly space out the sleeping (e.g., each connection spaced ~5ms apart). That should eliminate the "database is locked" error log for nearly every case.

There is also a TODO there around making sure we respect any :configure options passed in, which we will also want to address. I'm not sure if that would ever happen, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions