Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4177: Add upload location hints proposal #4177

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Fizzadar
Copy link
Contributor

@Fizzadar Fizzadar commented Aug 13, 2024

@Fizzadar Fizzadar changed the title Add upload location hints proposal MSC4177: Add upload location hints proposal Aug 13, 2024
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Aug 13, 2024
@Fizzadar Fizzadar marked this pull request as ready for review August 13, 2024 16:38

Server could use request IP to achieve this without any hints, though inaccurate and invalid when
a user is abroad. This is reasonable fallback behaviour for a server when clients do not provide
any location hint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a whole lot of experience with CDNs, but would it be reasonable to expose an endpoint that would allow the client to measure the network speed, e.g. by uploading/downloading a small file, from each location? And then it can use the location with the shortest time. It might not be entirely accurate, but might be better than guessing based on IP address, or trying to divine the right location based on a location code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah a test endpoint per location would be a handy addition here so clients can make informed decisions.

@@ -0,0 +1,63 @@
# MSC4177: Upload Location Hints
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only useful for uploads, or is would something similar also be useful for downloads?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both really - specified at upload time but yields benefits on download (assuming others downloading are in the same location/region).

could provide explicit options, or a baseline of options, "it is recommended location hints use
geographical ISO codes" for example.

## Alternatives
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds more like a routing issue and not a protocol issue. Can using something like Anycast routing or geo-based DNS help find the closest location?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the term you are looking for is EDNS Client Subnet. https://en.wikipedia.org/wiki/EDNS_Client_Subnet

What Wikipedia doesn't mention is NextDNS (and DNS0) and Adguard having more private implementations of it.

Copy link
Member

@clokep clokep Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of, I'm talking about how authoritative servers use that + the original source IP to serve close servers, like the GeoIP backend of PowerDNS or Route53 geolocation routing.

Maybe that's one in the same, but more the application instead of the underlying technology.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can using something like Anycast routing or geo-based DNS help find the closest location?

Definitely, although requires a more complicated setup. But also using request IP would satisfy most use cases here I think.

My thought process for the PR was to give explicit control/negotiation of locations over to clients/servers rather than the server guessing the best location for a client to upload files to.

Now that I’ve said that I’m not sure there’s really much improvement with this change..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client
  • Server


How do clients/servers interpret location hints? Is it sensible to leave this undefined/open. We
could provide explicit options, or a baseline of options, "it is recommended location hints use
geographical ISO codes" for example.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that a client would auto-select the most appropriate hint or would the user have to manually pick from the hints the server presents? For auto-selection to work, I think at least a recommendation of hint formats would be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s the idea, perhaps with a speed test endpoint as mentioned above.

## Security considerations

None? Reveals bucket locations (to logged in users), but servers are aware of this and there's
no security issue (I think).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the hints are expected to be more accurate than IPs, the server would possibly gain more metadata about the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants