lancachenet / lancache-dns

DNS Docker service for a lancache.
https://hub.docker.com/r/lancachenet/lancache-dns/
MIT License
285 stars 75 forks source link

Add support for multiple ips to resolve slow steam downloads #69

Closed VibroAxe closed 5 years ago

VibroAxe commented 5 years ago

Background

Steam uses a connection pool to manage download it's files. The library it uses appears to obey the full http spec and limit it's connection pool to 2-4 connections per IP (Not per host). The standard lancache container only has one IP per cdn and as such steams ability to download using multiple connections is restricted resulting in a slower initial download speed.

Changes

This PR allows multiple IP's to be set for any of the _IP environment variables, for example STEAMCACHE_IP="10.10.1.30 10.10.1.31".

Testing

This is currently a testing image. If you wish to help out testing please change your steamcache-dns docker command to pull from steamcache/steamcache-dns:multiple-ips then carefully follow the tuning guide below. Let us know your results in the comments.

Tuning your cache

The limitations seen in steam download speed are highly dependent on the latency between your server and the steam cdn servers. In the event you find your initial download speed with the default settings is slow this can be resolved by allocating more IP's to your steamcache. We suggest adding one IP at a time to see how much gain can be had (4 seems to work for a number of people)

Step 1: Adding IP's to your docker host

Consult your OS documentation in order to add additional IP addresses onto your docker cache host machine

Step 2: Adding IP's to your cache container

In order for this to work you need to add the port maps onto the relevant cdn container (for example steam).

VibroAxe commented 5 years ago

@JasonRivers fyi, I've made some slight changes and this now uses RPZ for the zone files as it's cleaner for the multiple IP allocations

fisheke commented 5 years ago

I can confirm this does fix my performance issue. Even seems to scale almost linearly with extra IPs allocated (going from 1 to 11 IP addresses boosted my through-cache downloads from 25MBit to 250MBit).

Still not resource constrained on anything as far as I can see, will experiment with even more IPs.

NoSnow3 commented 5 years ago

Can confirm adding 10 IP's has no restrictions and i am able to download at full rate of my internet connection as a single user downloader!

sta3b commented 5 years ago

@fisheke did u add several ip's to the same network card ? (so its like 1 NIC for steam that has several ip's assigned to it) , thank you

some-username-here1 commented 5 years ago

How did you get it to work? I tried setting it up on my end, but it's not working for me

cache-steam:

docker run \
  --restart unless-stopped -d \
  --name cache-steam \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/cache/steam/data:/data/cache \
  -v /home/download-cache/cache/steam/logs:/data/logs \
  -p 192.168.1.100:80:80 -p 192.168.1.101:80:80 -p 192.168.1.102:80:80 -p 192.168.1.103:80:80 -p 192.168.1.104:80:80 -p 192.168.1.105:80:80 -p 192.168.1.106:80:80 -p 192.168.1.107:80:80 \
  steamcache/generic:latest

steamcache-dns-multipleIPs:

docker run \
  --restart unless-stopped -d \
  --name steamcache-multipleIPs \
  -p 192.168.1.100:53:53/udp \
  -v /etc/localtime:/etc/localtime \
  -e STEAMCACHE_IP="192.168.1.100 192.168.1.101 192.168.1.102 192.168.1.103 192.168.1.104 192.168.1.105 192.168.1.106 192.168.1.107" \
  steamcache/steamcache-dns:multiple-ips

EDIT: Nevermind, I think I fucked up a setting on my computer since it won't work with the regular steamcache

some-username-here1 commented 5 years ago

Is it normal that after installing steamcache/steamcache-dns:multiple-ips on the same computer that I have steamcache/steamcache-dns:latest on, the former breaks the latter permamently? from what I'm getting after attempting to get it to work, a few times (and still trying to get it to work)

EDIT: I got it working, but it wasn't caching as fast as it would with just one IP (which was over 100 Mb/s, on the Xbox One), and after a while, it would stop caching from it completely

some-username-here1 commented 5 years ago

A problem I think I'm seeing is that you can not have a steamcache-dns container and a steamcache-dns:multiple-ips container exist at the same time, even with the former disabled and the latter enabled, or vice versa

some-username-here1 commented 5 years ago

Here's my docker run commands, by the way:

multicache-windowsupdate:

docker run \
  --restart unless-stopped -d \
  --name multicache-windowsupdate \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/windows-update/data:/data/cache \
  -v /home/download-cache/multicache/windows-update/logs:/data/logs \
  -p 192.168.1.100:80:80 \
  -p 192.168.1.101:80:80 \
  -p 192.168.1.102:80:80 \
  -p 192.168.1.103:80:80 \
  -p 192.168.1.104:80:80 \
  -p 192.168.1.105:80:80 \
  -p 192.168.1.106:80:80 \
  -p 192.168.1.107:80:80 \
  steamcache/generic:latest

multicache-steam:

docker run \
  --restart unless-stopped -d \
  --name multicache-steam \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/steam/data:/data/cache \
  -v /home/download-cache/multicache/steam/logs:/data/logs \
  -p 192.168.1.108:80:80 \
  -p 192.168.1.109:80:80 \
  -p 192.168.1.110:80:80 \
  -p 192.168.1.111:80:80 \
  -p 192.168.1.112:80:80 \
  -p 192.168.1.113:80:80 \
  -p 192.168.1.114:80:80 \
  -p 192.168.1.115:80:80 \
  steamcache/generic:latest

multicache-nintendo:

  --restart unless-stopped -d \
  --name multicache-nintendo \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/nintendo/data:/data/cache \
  -v /home/download-cache/multicache/nintendo/logs:/data/logs \
  -p 192.168.1.116:80:80 \
  -p 192.168.1.117:80:80 \
  -p 192.168.1.118:80:80 \
  -p 192.168.1.119:80:80 \
  -p 192.168.1.120:80:80 \
  -p 192.168.1.121:80:80 \
  -p 192.168.1.122:80:80 \
  -p 192.168.1.123:80:80 \
  steamcache/generic:latest

multicache-xboxlive:

docker run \
  --restart unless-stopped -d \
  --name multicache-xboxlive \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/xbox-live/data:/data/cache \
  -v /home/download-cache/multicache/xbox-live/logs:/data/logs \
  -p 192.168.1.124:80:80 \
  -p 192.168.1.125:80:80 \
  -p 192.168.1.126:80:80 \
  -p 192.168.1.127:80:80 \
  -p 192.168.1.128:80:80 \
  -p 192.168.1.129:80:80 \
  -p 192.168.1.130:80:80 \
  -p 192.168.1.131:80:80 \
  steamcache/generic:latest

multicache-minecraft (I know this was reverted, but it wouldn't hurt to reserve IPs for it):

docker run \
  --restart unless-stopped -d \
  --name multicache-minecraft \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/minecraft/data:/data/cache \
  -v /home/download-cache/multicache/minecraft/logs:/data/logs \
  -p 192.168.1.132:80:80 \
  -p 192.168.1.133:80:80 \
  -p 192.168.1.134:80:80 \
  -p 192.168.1.135:80:80 \
  -p 192.168.1.136:80:80 \
  -p 192.168.1.137:80:80 \
  -p 192.168.1.138:80:80 \
  -p 192.168.1.139:80:80 \
  steamcache/generic:latest

multicache-origin:

docker run \
  --restart unless-stopped -d \
  --name multicache-origin \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -v /etc/localtime:/etc/localtime \
  -v /home/download-cache/multicache/origin/data:/data/cache \
  -v /home/download-cache/multicache/origin/logs:/data/logs \
  -p 192.168.1.140:80:80 \
  -p 192.168.1.141:80:80 \
  -p 192.168.1.142:80:80 \
  -p 192.168.1.143:80:80 \
  -p 192.168.1.144:80:80 \
  -p 192.168.1.145:80:80 \
  -p 192.168.1.146:80:80 \
  -p 192.168.1.147:80:80 \
  steamcache/generic:latest

steamcache/steamcache-dns:multiple-ips:

docker run \
  --restart unless-stopped -d \
  --name steamcache-multipleIPs \
  -p 192.168.1.100:53:53/udp \
  -v /etc/localtime:/etc/localtime \
  -e WSUSCACHE_IP="192.168.1.100 192.168.1.101 192.168.1.102 192.168.1.103 192.168.1.104 192.168.1.105 192.168.1.106 192.168.1.107" \
  -e STEAMCACHE_IP="192.168.1.108 192.168.1.109 192.168.1.110 192.168.1.111 192.168.1.112 192.168.1.113 192.168.1.114 192.168.1.115" \
  -e NINTENDOCACHE_IP="192.168.1.116 192.168.1.117 192.168.1.118 192.168.1.119 192.168.1.120 192.168.1.121 192.168.1.122 192.168.1.123" \
  -e XBOXLIVECACHE_IP="192.168.1.124 192.168.1.125 192.168.1.126 192.168.1.127 192.168.1.128 192.168.1.129 192.168.1.130 192.168.1.131" \
  -e ORIGINCACHE_IP="192.168.1.140 192.168.1.141 192.168.1.142 192.168.1.143 192.168.1.144 192.168.1.145 192.168.1.146 192.168.1.147" \
  steamcache/steamcache-dns:multiple-ips

And static addresses 192.168.1.(100-150)/32 are also reserved in Ethernet Connection, with 192.168.1.1 being the gateway

sta3b commented 5 years ago

@some-username-here1 so technically ur running 6 NIC and each one with 8 assigned IP's , correct ? thanks!

VibroAxe commented 5 years ago

@some-username-here1 FYI, it should only be steam which needs the multiple IPs, you may also get a cleaner solution using Monolithic instead of generic (saves the 5 seperate containers).

VibroAxe commented 5 years ago

Approved via uklans discord

Peon-SouthAfrica commented 5 years ago

Hi,

Thanks for this useful piece of software.

When will there be a complete updated quide available? Ive even tried HAProxy to roundrobin inbound connections to port80, still 1 PC cant get max speed out of the cache server.

Peon

VibroAxe commented 5 years ago

@Peon-SouthAfrica you shouldn't need haproxy anymore, if you switch to using monolithic and then follow the readme including "tuning your cache"

Peon-SouthAfrica commented 5 years ago

HAProxy was just an attempt to try and get more speed. It didnt work sadly.

Should I post the commands im issuing?

VibroAxe commented 5 years ago

@Peon-SouthAfrica if you are still seeing this issue can you create a new issue on generic or monolithic as appropriate