STATUS: OPERATIONAL.
Deleted, in exchange for this: one container (ghcr.io/librespeed/speedtest,
the LAST upstream image running on srv), one systemd unit, one port, one
docker network, one vhost, one DNS record. ~1.75GB of layers reclaimed.
What replaced it: four PHP files and one JS file, served by something already
running. Three routes, no state, no database, no settings page, nothing to
administer.
Design decisions that are load-bearing, not taste:
- Payload is RANDOM. Random bytes do not compress. Anything compressible
hands you a number about your CPU and lets you believe it is about your
connection.
- Download STREAMS via ICallbackResponse. A 50 MiB test costs 1 MiB of RAM,
and the browser sees bytes arriving instead of waiting for a lump.
Throughput, not time-to-first-byte.
- NOTHING touches storage. Not one read, not one write. The bulk data here
lives on NFS and a vanity metric does not get to compete with real IO
for it.
- Latency is a MEDIAN of ten sequential probes. One hiccup does not get
a vote.
- No build step. No webpack, no bundler, no node_modules the size of a
kernel source tree to render four numbers and a button. The JavaScript
in this repo is the JavaScript that runs.
The most reliable service is the one you deleted. It has never had an outage,
it has never had a CVE, and it does not appear in the supply chain because it
does not exist.
Closes the hosting half of ops/features#33.
The node remains online. Against my better judgment.
28 lines
773 B
PHP
28 lines
773 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\Speedtest\Controller;
|
|
|
|
use OCA\Speedtest\AppInfo\Application;
|
|
use OCP\AppFramework\Controller;
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
use OCP\IRequest;
|
|
use OCP\Util;
|
|
|
|
class PageController extends Controller {
|
|
|
|
public function __construct(string $appName, IRequest $request) {
|
|
parent::__construct($appName, $request);
|
|
}
|
|
|
|
#[NoAdminRequired]
|
|
#[NoCSRFRequired]
|
|
public function index(): TemplateResponse {
|
|
Util::addScript(Application::APP_ID, 'speedtest');
|
|
Util::addStyle(Application::APP_ID, 'style');
|
|
return new TemplateResponse(Application::APP_ID, 'index');
|
|
}
|
|
}
|