Skip to content
/ tusq Public

A fast and simple transactional postgres connection pooler written in rust (BETA)

License

Notifications You must be signed in to change notification settings

film42/tusq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tusq

A postgres transactional connection pooler written in rust. It currenlty uses an 8KB buffer for each client or server connection. It is as fast as pgbouncer in basic select * from table benchmarks. My goal for this project is to write a postgres connection pooler that is very fast and written in a highly readable way, making outside contribution easy.

Running

Use cargo to build this project. After running and connecting via psql, you'll see the following:

$ cargo run --release -- --config examples/config.toml

[2021-01-02T16:49:38Z INFO  tusq] Listening on: 127.0.0.1:8432
[2021-01-02T16:49:40Z INFO  tusq] Client connected: "PollEvented { io: Some(TcpStream { addr: 127.0.0.1:8432, peer: 127.0.0.1:35822, fd: 10 }) }"
[2021-01-02T16:49:40Z INFO  tusq::pool] Connecting to database: StartupMessage { protocol_version: 196608, parameters: {"application_name": "tusq", "client_encoding": "UTF8", "database": "dispatch_development", "user": "testuser"} }
Client closed: "PollEvented { io: Some(TcpStream { addr: 127.0.0.1:8432, peer: 127.0.0.1:35822, fd: 10 }) }"

Config

Currently using TOML for config files:

bind_address = "127.0.0.1:8432"

[databases]
some_db = { user = "postgres", password = "123456", dbname = "yolo_db", host = "127.0.0.1" }

You can also specify port and pool_size for each database.

You can send a SIGHUP to the running tusq process for a live config reload.

TODO

  1. Support SSL.
  2. Better configuration.
  3. Benchmarking.
  4. Canceling queries.

License

MIT

About

A fast and simple transactional postgres connection pooler written in rust (BETA)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages