They are flat files stored in the /results directory on the web server (under the docroot for the webpagetest UI). They are grouped by year/month/day so it's pretty easy to trim old tests.

There are also archive settings you can configure in settings.ini to have it zip each test result and drop them into a separate folder and a cli script (cli/archive.php) that can go through and prune anything locally that is older than X days (the code knows how to restore from the archived zips automatically on access).

For the public instance I have the raw tests on SSD's that are set up to archive off to magnetic after 6 hours and there is a separate script that archives those off to a NAS for long-term backup.