Skip to content

Multi-tenancy connection management #83

Closed
@vanobig

Description

@vanobig

Hey guys, do you have any recommendations on how to approach this task?
I need to manage a pool of connections in a multi-tenancy environment, means I have multiple DBs to talk to. Since I cannot afford creating a new Db connection upon each request, I have to create a pool of connections.

The way how DB connection is meant to be created is to:

  1. conn, err := graphHTTP.NewConnection(...)
  2. c, err := graphDriver.NewClient(...)
  3. db, err := p.cl.Database(...)

Implementation of the #3 uses a copy of the conn from #1. What it means to me is that even if I maintain my own pool of the db objects, every single one will hold a copy of the identical connections (in fact it's a connection pool). Since Database constructor is defined as private (newDatabase), even if I want to write my own implementation of #3 (with a pointer to the conn), I cannot bypass it.

Any suggestion on how to address the issue?

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