Skip to main content

mktorrent with pthreads

The ultra documentation points to the Ubuntu version of mktorrent which is single threaded. This feedback request will explain how to make torrent creation multi-threaded using pthreads. It will make torrent creation 4 to 8 times faster on ultra infrastructure. The practical use case is a service enhancement for the ruTorrent web portal.

Reference: https://docs.ultra.cc/books/pre-installed-tools/page/list-of-pre-installed-tools#bkmrk-mktorrent

It’s required to the build-essential package to perform this task.

Step 1: Download the source files.

curl -sL https://github.com/pobrn/mktorrent/archive/v1.1.zip -o mktorrent.zip

Step 2: Unzip the source files and change directory.

unzip -d mktorrent -j mktorrent.zip && cd mtorrent

Step 3: Update the build configuration with these recommended values.

 echo "CC = gcc" >> Makefile	
 echo "CFLAGS = -w -flto -O3" >> Makefile
 echo "USE_PTHREADS = 1" >> Makefile
 echo "USE_OPENSSL = 1" >> Makefile

Step 4: Build the software and install it to the same prefix.

make -j$(nproc)
make install PREFIX=/usr
Status: Rejected1 comment

Comments1

  • varg

    Team•

    Dec 10, 2024

    Thank you for your contribution.

    However, with make -j$(nproc), it will build using all cores, and an increase in RAM usage, which can cause make to fail. It's best to use make -j1 and be patient!

    Furthermore, creating torrents with multiple threads could easily be abused and lead to a Fair Usage Policy violation. Please keep in mind that our service is of a shared nature, and you need to be mindful of your server neighbors. Take care and monitor your resource usage.

    It is not forbidden to proceed with the above mentioned steps, but it is highly discouraged due to the high risk of abuse. We will therefore mark this request as Rejected, as it will not be implemented as default.