"Fast Download" (for example by using CDN) for resources

Hi guys,

It seems like there’s no any way to make people getting all the needed resources via some HTTP server (like CDN). That way I could save some bandwidth and also be able to push it all to players faster (by geolocation/more network capacity etc).

Not as simple as you might think it is, there are two concerns with this:

  1. Updating the remote endpoint. Originally, the server shipped an FTP/FTPS client to do this, but that led to some issues, and the server had been rewritten in another language since, so that’s not a thing anymore.
  2. Support for resource obfuscation that is typically done by the built-in web server.

It has been considered to provide some sort of reverse proxy frontend for server connections that can then be put behind any typical caching proxy/load balancer, but it is non-trivial to change the server connection logic to decouple default TCP and UDP endpoints from the HTTP endpoints.

Hmm, I think it shouldn’t be your concern in which way I’d send all of these resources to the another server (like CDN/HTTP). I’d appreciate a possibility to set HTTP address for resources (nothing more than that). Btw, there’s always smth like rsync that could automatically fetch everything from the server where FiveM is run.

I could - as you brought up - just run a reverse proxy (e. g. Nginx or Lighttpd) and that would work along with Cloudflare which allows cache up to 200 MB per file. That would definitely boost download speed for most of players.

Not gonna lie, I don’t quite understand this part of your answer.

Lots of assets are generated at runtime, so it is the server’s concern that the right data is sent to clients.

Okay, this changes the whole situation. One more question: are file names changed or new ones added? Cloudflare allows for a permanent cache (storing files on their servers), but until a refresh request is sent, these files remain unchanged - but new files may be loaded. If only new files are added, this would already be a easy real CDN and it would help a lot to handle more players at the same time (and deliver content much faster).

I think HTTP from Nginx to the specified directory where these resources are located would be a good deal.

https://support.cloudflare.com/hc/en-us/articles/200394750-What-s-the-maximum-file-size-CloudFlare-will-cache-

I haven’t tried this but would this work? Allow configuring fileServer to be a CDN server and add the option to pass a password to the /files/ endpoint to be used instead of clientid. With that you could setup a CDN server that downloads from the game server using the password when there is a cache miss. This of course assumes you are also using adhesive_cdnKey.

If that works then that would certainly be easier than the current approach of setting up a reverse proxy in front of the game server(assuming that still works).

That’s still more complex than just passing a client ID from an in-flight request, and would just be equivalent to a reverse proxy in front of the game server anyway, except requiring even more specific logic.

But, yes, fileServer would be one way such a reverse proxy could be exposed.

However, the idea behind decoupling UDP and TCP connectivity was mainly so that no server IPs would be exposed until completing a full connection handshake, as you’d only get a standard HTTP reverse proxy (which might’ve been behind, even, say, CF) ‘publicly’ available, and you’d only be sent a valid UDP endpoint upon completing a connection (which might in itself be a frontend forwarder out of some sort of pool) which’d allow for a tad more complex server setups, again.

1 Like