steam-lancache-prefill

repository·master·Indexed 19 days ago

https://github.com/tpill90/steam-lancache-prefill

A tool to automatically populate a Lancache with Steam games to improve local download speeds and reduce external bandwidth usage. It supports Windows, Linux, MacOS, Arm64, Docker, and unRAID. Key features include an interactive app selection menu, version-tracked prefilling to download only updates, a benchmarking tool to identify disk I/O or CPU bottlenecks, and the ability to prefill entire libraries or top popular games.

Tokens
7.4K
Snippets
36
Records
48
Agent score
65%

What's inside steam-lancache-prefill

  1. How the benchmark workflow works

    master

    The benchmark tool is designed to identify Lancache bottlenecks (typically disk I/O) by simulating a sustained, repeatable download workload. It can be used on both the server and client sides without requiring a Steam login.

    The workflow consists of two distinct phases:

    1. benchmark setup: Creates a "workload" file containing a collection of apps. This workload defines the specific data that will be requested during the test. You should choose apps that closely match your typical download patterns.
    2. benchmark run: Executes the workload created in the setup phase. It performs an initial warmup (downloading all data to ensure it is cached and flushing server memory) followed by multiple iterations of downloading the same workload in a randomized order to measure throughput.

    Important Note on Accuracy: To ensure you are testing actual disk I/O rather than system memory (RAM) caching, ensure your benchmark workload size is larger than the Lancache server's total amount of memory.

    # Example workflow
    ./SteamPrefill benchmark setup --use-selected
    ./SteamPrefill benchmark run --iterations 10
  2. Understand the MkDocs project layout

    master

    The documentation structure follows this layout:

    • mkdocs.yml: The root configuration file for MkDocs.
    • mkdocs/: The directory containing all documentation content.
      • index.md: The homepage of the documentation.
      • assets/: Custom JavaScript and CSS files.
      • custom_theme/: Theme-specific files.
      • img/: Images.
      • img/svg/: SVG images (including rendered .ansi files from the parent directory).
      • ...: Various other markdown pages and assets.
  3. Understand Steam CDN Regions and CellIds

    master

    Steam uses internal identifiers called CellId to manage Content Delivery Network (CDN) regions.

    Important Limitations:

    • Manual Overrides: As of 2024-10-04, it is no longer possible to manually choose a CDN region in Steam for downloads. While the Steam client may show a list of regions in the 'Download Region' setting, Steam automatically determines the optimal download region based on internal geolocation criteria. Setting an override region typically has no effect on which region your client actually uses.
    • Login vs. Download: You may still be able to choose a region for logging into Steam, but this is distinct from the download region selection.
    • Region Validity: Many regions listed in the Steam client do not actually exist. Only regions corresponding to valid CellId values are functional.
  4. Update previously prefilled apps

    master

    To update your cache with newer versions of previously selected games, simply run the prefill command again.

    SteamPrefill tracks the version of each app. It will:

    • Skip apps that are already up to date.
    • Re-download only the new data for apps that have a newer version available.

    Because of how Lancache works, updates are typically much faster than the initial prefill because existing data is retrieved from the local cache while only new update data is fetched from the internet.

    # On Linux
    ./SteamPrefill prefill
    
    # On Windows
    .\SteamPrefill.exe prefill
  5. Run the project

    master

    You can run the project using dotnet run. By default, this runs in Debug mode, which is useful for development but slower than Release mode.

    To pass arguments to the application, use the -- separator after the run command.

    To run the project with full optimizations (equivalent to a production build), use the --configuration Release flag.

    # Run in Debug mode (default)
    dotnet run
    
    # Run with specific command arguments (e.g., prefill all apps)
    dotnet run -- prefill --all
    
    # Run in Release mode for full speed
    dotnet run --configuration Release
  6. Force a complete re-download of all apps

    master

    If you need to ensure the cache is 100% primed or want to perform diagnostics/benchmarking, use the --force (or -f) flag. This overrides the default behavior of only downloading updates and forces the tool to re-download every selected app from scratch, filling in any potentially missing data.

    # Force re-download of all apps
    ./{{prefill_name}} prefill --force