Giter VIP home page Giter VIP logo

pgagroal's Introduction

pgagroal

pgagroal is a high-performance protocol-native connection pool for PostgreSQL.

Pronounced: p-g-a-gro-al, named after Agroal in Portugal.

Features

  • High performance
  • Connection pool
  • Limit connections for users and databases
  • Prefill support
  • Remove idle connections
  • Perform connection validation
  • Enable / disable database access
  • Graceful / fast shutdown
  • Prometheus support
  • Grafana 8 dashboard
  • Remote management
  • Authentication query support
  • Failover support
  • Transport Layer Security (TLS) v1.2+ support
  • Daemon mode
  • User vault

See Getting Started on how to get started with pgagroal.

See Configuration on how to configure pgagroal.

See Performance for a performance run.

Overview

pgagroal makes use of

  • Process model
  • Shared memory model across processes
  • libev for fast network interactions
  • Atomic operations are used to keep track of state
  • The PostgreSQL native protocol v3 for its communication

pgagroal will work with any PostgreSQL compliant driver, for example pgjdbc, Npgsql and pq.

See Architecture for the architecture of pgagroal.

Tested platforms

Compiling the source

pgagroal requires

On Rocky Linux (and similar) operating systems, the dependencies can be installed via dnf(8) as follows:

dnf install git gcc cmake make    \
            libev libev-devel     \
            openssl openssl-devel \
            systemd systemd-devel \
            python3-docutils      \
            libatomic             \
            cjson cjson-devel

Please note that, on Rocky Linux, in order to install the python3-docutils package (that provides rst2man executable), you need to enable the crb repository:

dnf config-manager --set-enabled crb

Alternatively to GCC, clang 8+ can be used.

Release build

The following commands will install pgagroal in the /usr/local hierarchy and run the default configuration.

git clone https://github.com/agroal/pgagroal.git
cd pgagroal
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
/usr/local/bin/pgagroal -c /usr/local/etc/pgagroal/pgagroal.conf -a /usr/local/etc/pgagroal/pgagroal_hba.conf

See RPM for how to build a RPM of pgagroal.

Debug build

The following commands will create a DEBUG version of pgagroal.

git clone https://github.com/agroal/pgagroal.git
cd pgagroal
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
cd src
cp ../../doc/etc/*.conf .
./pgagroal -c pgagroal.conf -a pgagroal_hba.conf

Remember to set the log_level configuration option to debug5.

Contributing

Contributions to pgagroal are managed on GitHub.com

Contributions are most welcome !

Please, consult our Code of Conduct policies for interacting in our community.

Consider giving the project a star on GitHub if you find it useful. And, feel free to follow the project on Twitter as well.

License

BSD-3-Clause

pgagroal's People

Contributors

2010youy01 avatar an-dj avatar ashu3103 avatar davidfetter avatar decarv avatar df7cb avatar eugig avatar fluca1978 avatar hao-tian-xu avatar jesperpedersen avatar lawrence910426 avatar nikitabugrovsky avatar sudeepred avatar t1t4m1un avatar will avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgagroal's Issues

Transaction level pooling

As far as I understand pgagroal implements session level pooling, i.e. number of sessions is equal to number of Postgres backends.
So pgagroal can not be used to restrict number of Postgres backends (as pgbouncer/Odyssey can do). It can only help when clients do not establish permanent connections with database but perform connect/disconnect on each operation. But it seems to be quite exotic use case now, doesn't it?

Are there any plans to support transaction level pooling?

Daemon support

Add support for a daemon process, pid_file configuration parameter and a pgagroal-cli stop command

Architecture

Describe the architecture in more detail with all major components

  • Shared memory
  • Atomic operations
  • Management
  • libev usage

Add a status command

pgagroal-cli status should return

  • Status of pgagroal
  • Active connections
  • Total connections
  • Max connections

Set the process title

Set the process title for all connections such that ps will list them nicely.

Should only be

... pgagroal: myuser <active>

or

... pgagroal: myuser <in-pool>

such that the overhead of setting the status is limited.

Log connections

Log connections and disconnections using log_connections and log_disconnections.

Both are Bool and off by default.

Add a details command

Like pgagroal-cli status but includes information of the potential "sub-pools" as well.

Pipeline lifecycle

Create a lifecycle for a pipeline that allows to have a pipeline specific shared memory segment across instances

Graceful shutdown

Support graceful shutdown where existing connections are allowed to finish their session.

Add gracefully command to pgagroal-cli and trigger on SIGTRAP as well.

Incorrect encoding of passwords

The encrypted password string may contain characters that strlen() doesn't understand.

Pass the string length in explicit.

Admin: Add -U and -P switches

Add a -U switch for specifying a user name, and a -P switch for specifying a password.

These switches should be used in scripted environments.

Log rotation

Implement log rotation for files - could be based on a date or size.

Will require log_path to understand date modifiers like %Y, %m, %d, %H, %M and %S.

User vault

Create a vault where user names and passwords are stored

Transaction pooling

Create a pipeline that pools connections on the transaction boundary.

The slot will be valid during the start() method of the pipeline. The user / database information should be copied to a pipeline memory segment.

If pgagroal_get_connection() returns a non-zero value an error should be sent to the client and communication terminated.

Implementation should be in pipeline_transaction.c.

Configuration should be done through

[pgagroal]

pipeline = transaction

Log formatting

Implement log formatting codes that can style the logging output. Could borrow similar codes as PostgreSQL.

May require changes to zf_log.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.