lancachenet / monolithic

A monolithic lancache service capable of caching all CDNs in a single instance
https://hub.docker.com/r/lancachenet/monolithic
Other
725 stars 73 forks source link

Download Speed dropping after a couple of seconds #162

Closed sn1ce closed 1 year ago

sn1ce commented 1 year ago

Describe the issue you are having

After a couple of seconds (around 3-4 sec.) steams downloadrate drops to 0 Kb/s and after again some secs., it goes up to around 10-20% auf my actual download speed

How are you running the container(s)

version: '3'
services:
  monolithic:
    container_name: monolithic
    image: lancachenet/monolithic:latest
    ports:
      - "80:80"
    volumes:
      - /home/lanserver/nvme/lancache/data:/data/cache
      - /home/lanserver/nvme/lancache/logs:/data/logs
    environment:
      - CACHE_MEM_SIZE=2500m
    restart: always

DNS Configuration

  lancachedns:
    container_name: lancachedns
    image: lancachenet/lancache-dns:latest
    ports:
      - "10.0.0.167:53:53/udp"
    environment:
      - USE_GENERIC_CACHE=true
      - LANCACHE_IP=10.0.0.167
    restart: always
  sniproxy:
    container_name: sniproxy
    image: lancachenet/sniproxy:latest
    ports:
      - "443:443"
    restart: always

Output of container(s)

server {

# Internal bind on 3128, this should not be externally mapped
listen localhost:3128 reuseport;

# No access_log tracking as all requests to this instance are already logged through monolithic

# access_log /data/logs/upstream-access.log cachelog;
error_log /data/logs/upstream-error.log;

# Including /etc/nginx/sites-available/upstream.conf.d/10_resolver.conf
resolver 8.8.8.8 8.8.4.4 ipv6=off;

# Finished including /etc/nginx/sites-available/upstream.conf.d/10_resolver.conf
# Including /etc/nginx/sites-available/upstream.conf.d/20_tracking.conf
# Header to track if resolved from upstream or 302 redirect
set $orig_loc 'upstream';
# Finished including /etc/nginx/sites-available/upstream.conf.d/20_tracking.conf
# Including /etc/nginx/sites-available/upstream.conf.d/30_primary_proxy.conf
# Proxy all requests to upstream
location / {
# Simple proxy the request
proxy_pass http://$host$request_uri;

# Catch the errors to process the redirects
proxy_intercept_errors on;
error_page 301 302 307 = @upstream_redirect;
}
# Finished including /etc/nginx/sites-available/upstream.conf.d/30_primary_proxy.conf
# Including /etc/nginx/sites-available/upstream.conf.d/40_redirect_proxy.conf
# Special location block to handle 302 redirects
location @upstream_redirect {
# Upstream_http_location contains the Location: redirection from the upstream server
set $saved_upstream_location '$upstream_http_location';

# Set debug header
set $orig_loc 'upstream-302';

# Pass to proxy and reproxy the request
proxy_pass $saved_upstream_location;
}
# Finished including /etc/nginx/sites-available/upstream.conf.d/40_redirect_proxy.conf
}
# Finished including /etc/nginx/sites-enabled/20_upstream.conf
}

stream {
# Including /etc/nginx/stream.d/log_format.conf
log_format stream_basic '$remote_addr [$time_local] $protocol $status $ssl_preread_server_name $bytes_sent $bytes_received $session_time';
# Finished including /etc/nginx/stream.d/log_format.conf
# Including /etc/nginx/stream-enabled/10_sni.conf
server {
listen 443;
resolver 8.8.8.8 8.8.4.4 ipv6=off;
proxy_pass $ssl_preread_server_name:443;
ssl_preread on;

access_log /data/logs/stream-access.log stream_basic;
error_log /data/logs/stream-error.log;
}
# Finished including /etc/nginx/stream-enabled/10_sni.conf
}

# Finished including /etc/nginx/nginx.conf
Checking nginx config
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Config check successful
Starting Supervisord

Hi there, first of all, thanks for providing this lancache, pretty cool.

I want to mention, that i want to use it for small lanparty, and even for my own use.

My Lanserver is connected to a USB3.0 to 2.5GBE Adapter -> 2.5GBit Switch -> Gaming PC with 2.5Gbit.

When I download a cached game, e.g. Left 4 dead, it is hitting the full speed for a couple of seconds, then it drops to zero, and after that it goes up to around 50-60 mb/s.

I can remember on my last Lanparty, i had "only" 1 Gbit, and this was working pretty well without any issues. I checked my USB Adapter, but this seems to run fine with iperf3 and iperf1.

My specs for the Lanserver are:

Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz 12 GB RAM (since one died yesterday) will change this 1 TB NVME PCIe - speeds are as expectet around 3Gbit

Help is appreciated :)

Many thanks!

sn1ce commented 1 year ago

Hi Again, got some update. After changing the two variables:

      - CACHE_MEM_SIZE=5000m
      - CACHE_INDEX_SIZE=1000m

and also using another game, the speeds are more then correct now. I think (not sure, since i didn't checked it), if for example Left 4 dead 2 is using some https connections.

For Cities skylines, They are billions and Dota underlords, it worked with around 240 mb/s .

AND:

My new Lanserver is on its way, with a i5 6500, 16 GB DDR4 and 1TB NVME . I think this doesnt matter, since my current Lanserver ist using not that much CPU and SSD utilization.

Serverfrog commented 1 year ago

I have kinda the same Problem with kinda the same Setup. For me, im running it on a Kubernetes Cluster, the Host where its running on has a USB3 M.2 as Cache Disk, it also has a 2.5 GBit Ethernet Connection (Interface on the Host and Switch). This is then going over the 10 GBit Interface of the Switch to the 10 GBit Interface of my (Gaming/Download) PC.

I Tested it without Lancache and i get around 100 MB/s over my Connection. With Lancache i get around 100MB/s for around 2 Seconds, then it starts rapidly falling down to 0, then the Healthcheck http://:80/lancache-heartbeat wont answer anymore in a timeframe of 1s and gets killed.

I will tests the CACHE_MEM_SIZE Variable, but it isn't really limited by Cache on that cluster.

This Problem is also occurring not since the beginning. I think it started some Months ago, since then i limited my Download Speed, to not kill my DNS in my network. The Limit where Lancache "survives" is 10000 KB/s, at 150000 it would be overwhelmed.

I Also noticed that after many Cache misses, it will stop responding, which i think is then the reason the heartbeat wont response also

sn1ce commented 1 year ago

Hi, Did you deploy it with a custom created helm-chart? Or is there even a helmchart available? Was also thinking to spin up a kubernetes Cluster. After changing my Setup to my mentioned upgrade, and let it run over months now, it looks like its almost working.

But thats only for Steam, Battle.net is still a problem. Don't know, whats causing the "issue" of such limited bandwith. Or even dropping to 0 KB/sec.

Serverfrog commented 1 year ago

Did use the (now deprecated, need to update) k8s@home chart for it.

I also added that configurations and it lived longer than before but not long. Did try a 5,1 GB Steam Download, after 4 GB it went down to 0, Lancache was not Reachable anymore and was killed.

This was also only when the Game is downloaded from the Internet, Directly from Cache (quick reinstall of a Game after the download) it worked fine

stale[bot] commented 1 year ago

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed after being inactive for 30 days. If you require further assistance please reopen the issue with more details or talk to us on discord