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:
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/v1/ 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
- the action api could make the action itself a path component: /api/action/query?prop=revisions&..
- /api/rest/v1 instead of /api/v1/ - don't use the magic 'v1' name
- 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/
Current discussion status
We discussed this over the last days & this morning on IRC. Summary:
- There is broad support for the /api/{name}/ pattern.
- We want to keep our Varnish setup simple by mapping each API to a single backend.
- The concrete names for the REST and action APIs are not 100% decided yet, but
Next steps
We have two main options:
- Decide to move forward with /api/v1/
- Move forward with a temporary / uncontroversial name like /api/x1/, use that for VE only in private, then decide on the longer term name a bit later.
See also: