pgbouncer 是一个轻量的pg 连接池工具,我们可以和hasura graphql-engine集成起来,进行连接的一些优化

环境准备

  • docker-compose 文件
version: '3.6'
services:
postgres:
image: postgres:9.6
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
volumes:
- ./db_data2:/var/lib/postgresql/data
pgbouncer:
image: brainsam/pgbouncer
environment:
- DB_HOST=postgres
- DB_USER=postgres
- DB_PASSWORD=dalong
ports:
- "6432:6432"
graphql-engine:
image: hasura/graphql-engine:v1.0.0-alpha30
ports:
- "8080:8080"
depends_on:
- "postgres"
environment:
- "POSTGRES_PASSWORD:dalong"
command: >
/bin/sh -c "
graphql-engine --database-url postgres://postgres:dalong@pgbouncer:6432/postgres serve --enable-console;
"

说明

方式一样,主要是修改了连接的地址,因为使用了pgbouncer,地址修改为了pgbouncer server的地址,同时
对于pgbouncer server 配置了后端的pg server, 实际上hasura graphql-engine,后端的连接自身是支持数据库
连接池的,性能也很不错,但是如果使用引擎进行应用开发,参考3factor 的模型,是会存在数据回写的,使用
连接池工具可以帮助我们做好多事情,比如ha的处理,可以做到一些性能的提升

参考资料

https://github.com/pgbouncer/pgbouncer
https://hub.docker.com/r/brainsam/pgbouncer/
https://www.percona.com/blog/2018/06/27/scaling-postgresql-with-pgbouncer-you-may-need-a-connection-pooler-sooner-than-you-expect/

 
 
 
 

hasura graphql-engine集成pgbouncer 连接池工具的更多相关文章

  1. postgres高可用学习篇二:通过pgbouncer连接池工具来管理postgres连接

    安装pgbouncer yum install libevent -y yum install libevent-devel -y wget http://www.pgbouncer.org/down ...

  2. springboot 学习之路 6(集成durid连接池)

    目录:[持续更新.....] spring 部分常用注解 spring boot 学习之路1(简单入门) spring boot 学习之路2(注解介绍) spring boot 学习之路3( 集成my ...

  3. Druid连接池工具类

    package cn.zmh.PingCe; import com.alibaba.druid.pool.DruidDataSourceFactory; import javax.sql.DataSo ...

  4. 使用PgBouncer连接池

    1.pgbouncer 的介绍 pgbouncer是一个针对PostgreSQL数据库的轻量级连接池,任何目标应用都可以把 pgbouncer 当作一个 PostgreSQL/Greenplum 服务 ...

  5. C3P0连接池工具类实现步骤及方法

    C3P0连接池的工具类 使用C3P0获得连接对象连接池有一个规范接口 javax.sal.DataSourse 接口定义了一个从连接池中获得连接的方法getConnection(); 步骤导入jar包 ...

  6. Spring系列之集成Druid连接池及监控配置

    前言 前一篇文章我们熟悉了HikariCP连接池,也了解到它的性能很高,今天我们讲一下另一款比较受欢迎的连接池:Druid,这是阿里开源的一款数据库连接池,它官网上声称:为监控而生!他可以实现页面监控 ...

  7. springboot集成druid连接池

    使用druid连接池主要有几步: 1.添加jar和依赖 <groupId>org.mybatis.spring.boot</groupId> <artifactId> ...

  8. hasura graphql server 集成gatsby

    hasura graphql server 社区基于gatsby-source-graphql 开发了gatsby-postgres-graphql 插件, 可以快速的开发丰富的网站 基本使用 安装h ...

  9. 004-C3P0连接池工具类模板

    package ${enclosing_package}; import java.sql.Connection; import java.sql.ResultSet; import java.sql ...

随机推荐

  1. 网页的MVC模式简介

    #! /usr/bin/env python3 # -*- coding:utf-8 -*- #MVC:Model-View-Controller 模型-视图-控制器 #Python处理URL的函数就 ...

  2. 第三篇 功能实现(1) (Android学习笔记)

    第三篇 功能实现(1) 第8章 Android应用程序组成 ●Android的一些中.底层基础知识 ※ Android Framework 启动过程 Android手机系统本质上是一个基于Linux的 ...

  3. MeshLab 编译

    1.需要以下:  MeshLab 1.3.3  下载地址 http://sourceforge.net/projects/meshlab/files/meshlab Win7 X64  Visual ...

  4. Cracking The Coding Interview 4.7_暂存

    //原文: // // You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds ...

  5. Cracking The Coding Interview2.3

    #include <iostream> #include <string> using namespace std; class linklist { private: cla ...

  6. block,inline-block,行内元素区别及浮动

    1.block: 默认占据一行空间,盒子外的元素被迫另起一行 2.inline-block: 行内块盒子,可以设置宽高 3.行内元素: 宽度即使内容宽度,不能设置宽高,如果要设置宽高,需要转换成行内块 ...

  7. 堆排序python实现

    def MAX_Heapify(heap,HeapSize,root):#在堆中做结构调整使得父节点的值大于子节点 left = 2*root+1 right = left + 1 larger = ...

  8. MFC 添加背景图片并让控件背景透明

    /*添加背景图片*/ BOOL CTOOLDlg::OnEraseBkgnd(CDC* pDC) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CDialog::OnEraseBkg ...

  9. 2017ICPC南宁赛区网络赛 Train Seats Reservation (简单思维)

    You are given a list of train stations, say from the station 111 to the station 100100100. The passe ...

  10. 【Python】unittest-4

    #练习1: import random import unittest from TestCalc import TestCalcFunctions class TestSequenceFunctio ...