Using as few domain names as possible improves performance by:
- Reducing the number of DNS names to resolve
- Reducing the number of TCP (slow start) and TLS connections to set up, especially with SPYD/HTTP2
Currently https://rest.wikimedia.org/ is used to load HTML content in VisualEditor. As discussed in T94784, measurements show that about half of the load time on cold start (first access to rest.wikimedia.org) could be eliminated if the API was using the same domain & connection:
{F108039}
Technically setting up such an entry point should not be too hard in Varnish. The difficulty is in finding the right name. Candidates:
- `/api/` prefix, with `/api/rest/` and `/api/action/` children
- can provide a listing of available apis at `/api/`
- a single API prefix is easy to match in Varnish configs, and can be used as a single config target for API clients that consume several APIs
- rest v1 API at `/api/rest/v1/`
- the action api could make the action itself a path component: `/api/action/query?prop=revisions&..`
- alternative prefixes like `/_api/`, `/:api/` or `/_/` - won't conflict with articles at `/{title}` even if we removed `/wiki/` (see https://www.mediawiki.org/wiki/Requests_for_comment/Clean_up_URLs)
- use the root directly: `/rest/v1/` or just `/v1/`