Skip to content

kanalabs/trident

Repository files navigation

Trident 🔱

Trident is a generic light weight load balancer for aptos RPC's , This is heavily inspired by blutgang (A light weight load balancer built for ethereum RPC's) and contains sources from it

Check out Blutgang !

NOTE : THE LOAD BALANCER IS STILL UNDER DEVELOPMENT....

Starting the load balancer

cargo run --release -- -c config.toml

Using cargo watch

cargo watch -x 'run --release -- -c config.toml'

Using Docker (LOCAL)

NOTE : By default example.config.json is used as config file , to use custom configurations mount the config file while running docker

docker build -t trident .
docker run -d --name trident_container -p 3001:3001 -v ./config.toml:/app/config/config.toml trident

Using Docker (DOCKER HUB)

docker pull kanalabs/trident:latest
docker run -d --name trident_container -p 3001:3001 -v path/to/config.toml:/app/config/config.toml kanalabs/trident:latest

Example config.toml (Some of the features may not work)

# Config for trident 
[trident]
# Where to bind trident to
address = "0.0.0.0:3001"
# Moving average length for the latency
ma_length = 100
# Sort RPCs by latency on startup. Recommended to leave on.
sort_on_startup = true
# Enable health checking
health_check = true
# Acceptable time to wait for a response in ms
ttl = 60000
# How many times to retry a request before giving up
max_retries = 32
# Time between health checks in ms
health_check_ttl = 15000

[public]
url = "https://api.mainnet.aptoslabs.com"
# The maximum amount of time we can use this rpc in a row.
max_consecutive = 15
# Max amount of queries per second.
max_per_second = 15


[AnkrPublic]
url = "https://rpc.ankr.com/http/aptos"
# The maximum amount of time we can use this rpc in a row.
max_consecutive = 15
# Max amount of queries per second.
max_per_second = 15

License

please check LICENSE

About

Lightweight RPC load balancer built for Aptos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published