Skip to content

x/pkgsite: select healthy DB per request #40444

Open

Description

@jba

Currently, our service processes connect to a single DB on startup. If that DB enters a bad state while running, the process continues to run, serving 500s.

Instead, we should pick from a set of healthy DBs on each request.

Activity

  1. added
    FeatureRequestIssues asking for a new feature that does not need a proposal.
    on Jul 28, 2020
  2. self-assigned this
    on Jul 28, 2020
  3. added this to the Unreleased milestone on Jul 28, 2020
  4. gopherbot commented on Jul 28, 2020

    @gopherbot
    Contributor

    Change https://golang.org/cl/244603 mentions this issue: internal/frontend: get a DataSource on each request

  5. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jul 28, 2020
  6. jba commented on Sep 11, 2020

    @jba
    ContributorAuthor

    Alternative to picking a healthy DB connection per request:

    1. On startup, we connect to one of the configured DBs. All requests use the same connection. (This is the way it works now).
    2. We implement a health check that pings the DB.

    This will cause the health check watcher (AppEngine or the GKE load balancer) to quickly kill processes that are connected to a bad DB, and start new ones.

  7. heschi commented on Sep 14, 2020

    @heschi
    Contributor

    That approach will work well assuming a failure mode where one database becomes completely unavailable. If instead all the databases become 5% unavailable, e.g. because of a bug that overloads them all, they won't find a database that works all the time. Depending on the exact characteristics of the failure, how fast the instances get killed, and how fast they restart, that could end up making a minor outage into a very large one.

    There's also some risk with pointing each instance to a single database; after an outage on one replica, all the frontend instances will be pointed at the other replica.

    Since the failures we've seen so far are (AFAIK) total outages of one replica, this might be fine. But an approach that doesn't crash would be better in all respects, except perhaps for development ease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.pkgsite

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions