Illusory latency due to trailing slash redirects
solderpunk
solderpunk at SDF.ORG
Sat Jun 27 09:57:14 BST 2020
I sent the following email (and many others, which will follow shortly)
to the list last night, but SDF's mailserver was acting up and they
never went through. I thought they'd appear eventually, but it appears
not, so I'm resending them now. Apologies if double posts eventually
appear.
----- Forwarded message from solderpunk <solderpunk at SDF.ORG> -----
Date: Fri, 26 Jun 2020 15:47:57 +0000
From: solderpunk <solderpunk at SDF.ORG>
To: gemini at lists.orbitalfox.eu
Subject: Illusory latency due to trailing slash redirects
Gemini servers (and servers for any other protocol supporting relative
URLs, including HTTP) will use redirects to get clients to add a
trailing slash to a URL which maps to a directory on the server's
filesystem. Handling this redirect is often invisible to the client
user, with the result that what "looks and feels" like a single request
is actually two immediately consecutive requests. This makes latency
appear to be much worse than it actually is. Perhaps this underlies
some people's perceptions that Gemini has unacceptable latency.
This basic problem is unavoidable, but there are many small things
client and server authors can do to minimise how often it happens:
In general, the client can't add a missing trailing slash itself because
it never knows if a given URL maps to something file-like or something
directory-like. An interesting exception is the root of the server.
Molly Brown and Jetforce (but not GLV-1.12556) both seem to redirect
gemini.example.com to gemini.example.com/, making the loading of
"homepages" feel slower than it needs to. I'm pretty sure it should be
safe for clients to automatically append trailing slashes to URLs
without paths.
On the server side, server authors should take care when doing things
like automatically generating directory listings to put trailing slashes
in links to directories so that the redirect is not necessary.
These measures together could cut perceived latency in half for a
non-trivial proportion of Gemini requests, including the psychologically
heavily weighted request of visiting a server's homepage.
Cheers,
Solderpunk
More information about the Gemini
mailing list