All Projects → ewohltman → pool

ewohltman / pool

Licence: MIT license
Go library that wraps http.Client to provide seamless higher-level connection pooling features

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to pool

swoole-postgresql-doctrine-driver
🔌 A Doctrine DBAL Driver implementation on top of Swoole Coroutine PostgreSQL client
Stars: ✭ 15 (-61.54%)
Mutual labels:  pool, connection-pool
pool-reference
Reference python implementation of Chia pool operations for pool operators
Stars: ✭ 452 (+1058.97%)
Mutual labels:  pool, pooling
Pbbl
A thread-safe ByteBuffer pool that allows for the automatic reuse of ByteBuffers, which can be over 30x faster than having to allocate a new ByteBuffer when needed.
Stars: ✭ 32 (-17.95%)
Mutual labels:  pool, pooling
Stormpot
A fast object pool for the JVM
Stars: ✭ 267 (+584.62%)
Mutual labels:  pool, connection-pool
Pool
General Purpose Connection Pool for GRPC,RPC,TCP Sevice Cluster
Stars: ✭ 98 (+151.28%)
Mutual labels:  pool, connection-pool
Mobc
A generic connection pool for Rust with async/await support
Stars: ✭ 141 (+261.54%)
Mutual labels:  pool, connection-pool
Smproxy
Swoole MySQL Proxy 一个基于 MySQL 协议,Swoole 开发的MySQL数据库连接池。 A MySQL database connection pool based on MySQL protocol and Swoole.
Stars: ✭ 1,665 (+4169.23%)
Mutual labels:  pool, connection-pool
Puppeteer Cluster
Puppeteer Pool, run a cluster of instances in parallel
Stars: ✭ 2,175 (+5476.92%)
Mutual labels:  pool, pooling
honeycomb
A database connection pool that no one dares to use
Stars: ✭ 35 (-10.26%)
Mutual labels:  connection-pool
xdagj
XDAGJ is an implementation of XDAG in Java. https://xdag.io
Stars: ✭ 81 (+107.69%)
Mutual labels:  pool
p2pool
Decentralized pool for Monero mining
Stars: ✭ 635 (+1528.21%)
Mutual labels:  pool
42-piscine-exam
This repo has all exercises of "C Exam Alone In The Dark - Beginner" sorted from level_00 to Level_05
Stars: ✭ 218 (+458.97%)
Mutual labels:  pool
mysql-connection-pool-manager
This is a mySQL Connection Pool Manager wrapper powered by mysqljs/mysql and allows for intelligent management & load balancing mysql connection pools.
Stars: ✭ 15 (-61.54%)
Mutual labels:  pool
node-screenlogic
Pentair ScreenLogic Javascript library using Node.JS
Stars: ✭ 38 (-2.56%)
Mutual labels:  pool
softpool
SoftPoolNet: Shape Descriptor for Point Cloud Completion and Classification - ECCV 2020 oral
Stars: ✭ 62 (+58.97%)
Mutual labels:  pooling
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (-43.59%)
Mutual labels:  connection-pool
parallelizer
Simplifies the parallelization of function calls.
Stars: ✭ 62 (+58.97%)
Mutual labels:  pool
cardanocli-js
Wrapping the cardano-cli inside JavaScript
Stars: ✭ 173 (+343.59%)
Mutual labels:  pool
ptw
Pooling TLS Wrapper
Stars: ✭ 20 (-48.72%)
Mutual labels:  pooling
UT Framework
Various advanced tools built for Unreal Engine 4
Stars: ✭ 45 (+15.38%)
Mutual labels:  pooling

pool - An HTTP Client with autonomous connection pooling and rate limiting

GoDoc Go Report Card Build Status


pool wraps a standard *http.Client to add the ability to put a maximum number of connections in the pool for the client and the requests-per-second it can perform requests at.

It 'overloads' the http.Client.Do(req *http.Request) (*http.Response, error) method to implement the extended functionality. By doing so, existing codebases do not need to heavily re-factor how they already do their logic to see the effect of the more finely-tuned client.

Functions that take in a pool.Client allow for the ability to take in either a *pool.PClient or an *http.Client (since they both implement Do(req *http.Request) (*http.Response, error)). The function must operate on the argument's Do method since it will satisfy the interface for all types passed into it. See doPoolTest(client Client) error in pool_test.go for an example.

Installation


go get -u github.com/ewohltman/pool

Usage


// Some other examples are in pool_test.go

package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"

	"github.com/ewohltman/pool"
)

func main() {
    standardLibClient := &http.Client{}
    
    pooledClient := pool.NewPClient(standardLibClient, 25, 200)
    
    urlString := "https://yourFavoriteWebsite.com/"
    
    reqURL, err := url.Parse(urlString)
    if err != nil {
        fmt.Printf("[ERROR] Unable to parse: %s", urlString)
        os.Exit(1)
    }
    
    resp, err := pooledClient.Do(&http.Request{URL: reqURL})
    if err != nil {
        fmt.Printf("[ERROR] Unable to perform request: %s", err)
        os.Exit(2)
    }
    defer resp.Body.Close()
    
    _, err = ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Printf("[ERROR] Unable to read response body: %s", err)
        os.Exit(3)
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].