Introducing Sia-Antfarm: A Distributed Testing Framework for Sia





  • Today we're unveiling our new testing methodology for Sia.

    Testing complex, distributed systems is a challenge. While some functionality is pure and easy to test, you never quite know how a distributed system will behave until you deploy it on a real network with real machines. Our latest release revealed this fact quite plainly: code which was otherwise well tested showed cracks when subjected to the myriad edge cases of a real multi-node network in a stochastic environment. We've been heavily investing our recent development cycle at Nebulous into getting the existing feature set of Sia working far better. In order to accomplish this goal, we've created a new utility for performing complex, 'real-world' testing using multiple nodes over a real network, affectionately named 'Sia-Ant-Farm'. This utility creates a complete Sia ecosystem with miners, renters, hosts, and simple nodes, and continuously measures the successfulness of each node. Nodes can be assigned 'jobs' such as a renter which uploads and downloads files, or a host which provides storage for the network. These jobs provide constant feedback on their successfulness, providing invaluable introspection into how well Sia is working at a given moment. Each node is affectionally called an 'ant', and the group of ants is an 'antfarm'.

    Despite its current relative simplicity, Sia-Ant-Farm has already revealed a myriad of problems that were not apparent in our previous testing methodology. In the few short weeks Sia Antfarm has existed, several critical upstream changes have been made to the networking code directly improving reliability of the network. The resulting fixes will appear in the next release.

    Running an Ant Farm

    Sia-Ant-Farm contains two discrete programs: sia-ant, which creates a node with a number of assigned tasks, or jobs, and sia-antfarm, which creates a swarm of sia-ants from a .json manifest. An installed siad built with the dev tag is a prerequisite for running an antfarm. To use sia-antfarm, clone the git repo and run make install (you'll need a working Go dev environment). Once installed, create a manifest for your Ant Farm. Here's an example manifest that creates 3 nodes, 2 hosts and one renter, and connects them to each other automatically:


    {
    "AntConfigs":
    [
    {
    "Jobs": [
    "gateway",
    "renter"
    ]
    },
    {
    "Jobs": [
    "gateway",
    "host"
    ]
    },
    {
    "Jobs": [
    "gateway",
    "host"
    ]
    }
    ],
    "AutoConnect": true
    }


    Write your manifest to disk, then call sia-antfarm with the -config flag pointing to its location (ie: sia-antfarm -config /home/foo/config.json). sia-antfarm will start the 3 nodes and they will start performing their respective jobs, providing feedback on successfulness. The logs, and data, for each node can be viewed under the directory antfarm-data/.

    We will be continuously making improvements to this tool as well as pushing bug-fixes to the Sia platform as a result of the introspection provided by it. Several connectivity problems in our platform and in our dependencies have been resolved as a result of this tool, and we fully anticipate that it will be indispensable in achieving and ensuring the stability of the Sia platform for the foreseeable future.