Today we have some interesting news for you – the Torrent plugin for TeamCity!
With this plugin, users and build agents can download TeamCity build artifacts faster, especially in a distributed environment.
A bit of the BitTorrent protocol details
For those of you who are not familiar with BitTorrent – this is a peer-to-peer protocol. It means there is no single server for shared files. Instead, the files can be downloaded from peers that already have these files or parts of them.
Still, a server is required to find peers. This server is called a torrent tracker. To download a file, a peer must have a torrent file describing the required file. With this torrent file, the peer goes to the torrent tracker, and the tracker provides addresses of other peers in the network sharing the file.
A peer that does not have the file yet but wants to download it is called a leech. A peer that has the file and wants to share it is called a seeder.
Applying it to TeamCity
So what TeamCity Torrent plugin does – it turns TeamCity into a torrent tracker for all published artifacts greater than the specific size: by default, the artifacts of size less than 10 megabytes are not available via the BitTorrent protocol as it is not very efficient for small files. Additionally, the TeamCity server becomes a seeder for these artifacts. So for every artifact there is always one seeder in the network.
On top of that, when an agent decides to download an artifact dependency, it can choose to use the BitTorrent protocol instead of HTTP if there is more than one seeder available. Once the agent downloads the file, the agent itself automatically becomes a seeder for this file. When the agent publishes the artifact to the TeamCity server, both the server and agent start seeding it. So if you use TeamCity artifacts a lot, eventually you’ll end up with quite a number of agents seeding artifacts. Not only does this increase the speed of the artifacts delivery to agents, but it also reduces the load on the TeamCity server.
Finally, the users who have Torrent clients installed can also download files from TeamCity via the BitTorrent protocol.
Setting up the plugin
Verifying the plugin works
Clicking this icon should start your favorite torrent client. And this is what it looks like for some of the widely used artifacts on our server:
Please try this plugin and let us know what needs to be improved!