Skip to content

Tracker repository for the ReliableBT group project (UBC CPSC 416 2022W2).

License

Notifications You must be signed in to change notification settings

Maxwell-Yang-2001/reliableBT-tracker

Repository files navigation

Trakx

This is the tracker component for the Reliable BitTorrent group project (UBC CPSC 416 2022W2). The peer (baseline provider) repository can be found here, and the validation repository can be found here.


Performance focused BitTorrent tracker supporting HTTP, UDP, IPv4 and IPv6.

❤️‍🔥 Instances

Try Trakx for yourself! These instances are hosted on Oracles always free tier.

Status Protocol Address
✅Ok IPv4 UDP udp://u4.trakx.crim.ist:1337
✅Ok IPv6 UDP udp://u6.trakx.crim.ist:1337
✅Ok IPv4 HTTP http://h4.trakx.crim.ist/announce
✅Ok IPv6 HTTP http://h6.trakx.crim.ist/announce

🚀 Install

Go 1.19+ required.

git clone https://github.com/crimist/trakx && cd trakx

# install to go bin
go install .
trakx status # generates configuration

# or build
go build .
./trakx status # generates configuration

See configuration and netdata setup.

🔧 Configuration

Configuration file

The configuration file can be found at ~/.config/trakx/trakx.yaml. You'll have to run the trakx controller at least once to generate this file.

Config settings can be overwritten with environment variables:

$ cat trakx.yaml
...
loglevel = error
...

$ TRAKX_LOGLEVEL=DEBUG trakx run
2022-01-16T19:52:25.627-0800    DEBUG   Debug level enabled, debug panics are on
...

Trakx attempts to load the config file from the following directories in order:

  • .
  • ~/.config/trakx/

Default configuration & webserver files

You can modify the default configuration and files served by the webserver in the tracker/config/embeded/ folder.

NOTE: Trakx webserver will only serve files at their full path. dmca will 404, dmca.html will 200.

Binding to privileged ports

To bind to privileged ports I recommend using CAP_NET_BIND_SERVICE. More information can be found here.

$ sudo setcap 'cap_net_bind_service=+ep' ./trakx
$ TRAKX_TRACKER_HTTP_PORT=80 ./trakx run
2022-04-05T16:18:05.847-0700    INFO    HTTP tracker enabled    {"port": 80}

Netdata setup

Warning: install.sh will overwrite go_expvar.conf. If you are using other expvar programs with netdata manually merge the two files.

  • Run /etc/netdata/edit-config python.d.conf, change go_expvar to yes.
  • Customize the url in netdata/expvar.conf if needed.
  • Install netdata plugins with cd netdata; ./install.sh.

Build Tags

You can build with different tags with go build/install -tags <tag> .

Tags

  • fast will build without IP, seed, and leech metrics which will reduce cpu and memory usage
  • heroku will build trakx for app engines. This means the controller will not be built and trakx will run immediately when the binary is executed.

📈 Performance

The following metrics were collected on Heroku free tier running an HTTP tracker with the fast tag disabled.

Heroku dashboard:

performance

Database stats:

performance

Flamegraph:

flame

Trakx has been optimized to use a little CPU time as possible. In most cases, almost all CPU time will be spent handing (negotiating/send/recv) connections, especially for TCP (HTTP).

Trakx has also been optimized to use minimal memory and is mostly limited by the go GC. In this example the GC runs every 2 minutes (the forced GC period) at this level of traffic. The inuse_space delta from GC is 7.5% meaning this collection frequency would be sustained at GOGC=8.

About

Tracker repository for the ReliableBT group project (UBC CPSC 416 2022W2).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages