Hi!
I was thinking about a way to let "devpi use" select a replica
automatically.
This is more of a brain dump for now. My current idea would be this:
The primary server would provide a json file with a list of available
replicas. When you invoke "devpi use" on the primary server,
devpi-client would look for that list and then somehow select a good
replica.
The hard part is the selection of the replica.
A simple solution would be to request the +api route on each replica,
which is quick, and we measure the time it took. When we tried all
replicas, we use the fastest reply. This has some obvious problems, like
having to try all replicas, handling timeouts and momentary slowness of
replies. I still think this would be a nice addition. One can still
always explicitly "devpi use" a certain replica. IMO "devpi use" can
take up to 2-3 seconds for the replica selection without making it
painful for normal use.
The mirror selection could also be done server side, by providing a
dynamic replica list based on request IP or whatever.
Initially it would be easiest to provide the replica list statically via
nginx, because atm the primary only knows the IP address of replicas.
This is because most installations use the X-Outside-Url header instead
of the --outside-url option to provide more flexibility.
We might also want to provide a way in devpi-client to know which
replica belongs to a primary to share the login info. I guess the UUID
would be useful for that.
Regards,
Florian Schulze