Search Unity

Accelerator Options

Discussion in 'Unity Accelerator' started by gp-lhota, Nov 27, 2019.

  1. gp-lhota

    gp-lhota

    Joined:
    Sep 9, 2019
    Posts:
    3
    I am looking into the accelerator for a project which is going to upgrade to 19.3. I have started researching it and looking into all the configurable options.

    Documentation is very slim compared to the cache serve on github.
    I read over the following links and found very little related to options.
    https://docs.unity3d.com/2019.3/Documentation/Manual/UnityAccelerator.html
    https://forum.unity.com/threads/unity-accelerator-for-asset-import-pipeline-v2-out-now.756698/
    Other threads in this forum.

    Failing to find documentation I started browsing through the install and doing -h on the options I found.

    unity-accelerator -help
    unity-accelerator tool -h
    unity-accelerator run -help


    It looks like most options are stored in unity-accelerator.cfg

    It seems the default port is 10080 which is only known by looking at the picture in the "out now" thread.
    The default web GUI port is 8080. I found by guessing as it was the "LastUsedHTTPPort" value in the cfg file.

    I have a few questions. These are based on using the linux version.

    1. How do I specify the port to use that is entered in Unity (10080)?
    I found a few items related to ports are "HTTPPort" or run -http-port and "ProtobufPort" or run -protobuf-port. http port is for the web GUI. I assume ProtoBuf port is for transmitting data.

    2. How do I specify the cache location?
    While there is "CacheDir" or run -persist, these seem to be for the configuration and logs, not cache. When running with unity-accelerator-launch start after install and connecting with untiy, a directory named unity-accelerator-cache is created in the home directory. Can I override the location?

    3. Why are LastUsedHTTPPort and LastUsedProtoBufPort assigned seemingly random values when calling unity-accelerator-launch start?

    Thanks

    Brian
     
  2. hiepu3d

    hiepu3d

    Unity Technologies

    Joined:
    Jul 1, 2017
    Posts:
    63
    Hi Brian,

    We have recently published a document about the Accelerator Manual Installation. You can find more about that here: https://forum.unity.com/threads/accelerator-documentations.789593/

    When you launch the accelerator manually, it’s preferable to use the downloaded binary unity-accelerator instead of unity-accelerator-launch, which is our script for the installer wizard to interact with the Accelerator binary file.

    Regarding your questions,

    1. The HTTPPort is mainly used if you enable Accelerator for Unity Collaborate. It is also used for serving /metrics endpoint, which provides Prometheus metric reports. The ProtobufPort is used if you enable Accelerator for Asset Import Pipeline Version 2. You can specify the port to use by providing the flag -http-port or -protobuf-port when you run the binary.


    # Accelerator will listen on port 1234 for Protobuf requests and port 5678 for HTTP requests
    ./unity-accelerator run -protobuf-port 1234 -http-port 5678


    2. CacheDir is a different storage directory where we store the cache files, distinct from where the configuration and log files, .etc are stored. This is different from the persisted storage location provided through a flag described below.

    Under normal circumstances, when the Accelerator was first running, configuration and log files are generated but not the cache folder (which will be called cache), which is only created when the Editor sends WRITE requests to the Accelerator.​

    From what you described, I assumed unity-accelerator-cache is the storage location you provided during setup of installing the Accelerator. One way to change the cache location is to change the value of CacheDir as mentioned above. Another way is to use the binary file to register and run the Accelerator in a different location as below. If you don’t choose where persisted data will be stored, the default would be the current directory.


    # Accelerator will register to use Asset Import Pipeline Version 2 and create a configuration at PersonalCache directory
    ./unity-accelerator register -persist PersonalCache adbv2

    # Accelerator will run and use PersonalCache directory as storage location. The storage location needs to have a configuration file for the accelerator to run.
    ./unity-accelerator run -persist PersonalCache


    3. HTTPPort and ProtobufPort fields are the configured ports that you can set through the flags mentioned above. LastUsedHTTPPort and LastUsedProtobufPort are the actual ports that the Accelerator were listening on. When the configured ports are not set or have zero values, the Accelerator would choose a random available ports to listen on, which explains why the last used ports were assigned random values when you start the Accelerator.​
     
  3. gp-lhota

    gp-lhota

    Joined:
    Sep 9, 2019
    Posts:
    3
    ok, I've attempted to install using the GUI again and it displays dialog:

    Warning
    Installation has not completed correctly:
    error running service unity-accelerator start: /bin/sh: 1 service: not found

    Seems like it should be running unity-acclerator-launch start?

    when I do run unity-accelerator-launch start from the command line, it copies untiy-accelerator exe to the "caches files" location specified during setup. Is this correct? should there be a copy of the accelerator for each location?

    1. Before I move to the full manual install provided in your post, how would I complete the GUI setup properly from the command line since it is failing?


    2. It looks like the accelerator copies itself to the persist path when updates on enabled. On first run a file name unity-accelerator-next is in the persist directory. Stop the accelerator and run again, next is renamed to untiy-accelerator. I now two copies of unity-accelerator. one i downloaded and run and a second one in the persist path. Please explain.

    Brian
     

    Attached Files:

  4. hiepu3d

    hiepu3d

    Unity Technologies

    Joined:
    Jul 1, 2017
    Posts:
    63
    Could you tell me what OS you are running the Accelerator on?

    1. On Linux, we use service console utility to control the unity-accelerator service. From your error, it seems like the service application could not be found on your system. Please refer to these manuals for more information about service and systemctl. And to successfully complete the GUI setup, besides ensuring service utility is on the system, please run the .run program as root. This is because the installer wizard needs root access to create new service through the above service application.
    2. The accelerator runs as two processes, a parent process and a child process. The parent process simply keeps the child process running -- it will relaunch the child if it exits. This is to facilitate automatic updates because, on Windows, a running executable path cannot be replaced.

      The parent process will always run with the installed executable. What the child process runs depends. At first, it will be running the installed executable as well. When a new version is released, it will download it to unity-accelerator-next in the --persist directory, but it won't run it right away.

      When the accelerator is restarted, or it reaches its once-a-day maintenance window, it will rename any unity-accelerator-next executable to unity-accelerator, and the child will then run that unity-accelerator executable in the --persist directory (if it exists, otherwise it falls back to the installed executable).

      You can disable auto-updates with the --no-auto-updates command-line option (see 'unity-accelerator run --help' for the available options) and remove any unity-accelerator or unity-accelerator-next executable in the --persist directory. In this mode, there will still be parent and child processes, but the downloading of new versions won't happen anymore.
     
  5. gp-lhota

    gp-lhota

    Joined:
    Sep 9, 2019
    Posts:
    3
    Using Ubuntu 18.04.2 LTS on Windows Hyper-V.

    I did not run the installer .run as root. Do not believe that is mentioned in the instructions.

    fwiw, this is the output from "service"

    Command 'service' is available in '/usr/sbin/service'
    The command could not be located because '/usr/sbin' is not included in the PATH environment variable.
    This is most likely caused by the lack of administrative privileges associated with your user account.
    service: command not found

    which makes sense as you mention the installer needs to run with root privileges.

    ---------------------------------

    Did a manual install...

    downloaded following the manual install doc.
    query returned "v0.1.450+g1859fd6"
    used this link to download
    https://unity-accelerator-prd.storage.googleapis.com/unity-accelerator-v0.1.450+g1859fd6-linux

    Copied exe to /home/UnityAccel and made executable.

    Register:
    /home/server/UnityAccel/unity-accelerator register -persist /home/server/untiy-accel-data adbv2
    created the directory and .cfg file.

    Open the cfg file, shows "CacheDir": "/home/server/unity-accel-data"
    This is the location of the cfg not cache.

    Please explain as your post states:
    CacheDir is a different storage directory where we store the cache files, distinct from where the configuration and log files, .etc are stored. This is different from the persisted storage location provided through a flag described below. I assume if CacheDir = the configuration directory, a sub-directory named "cache" is created.

    ----------------------------
    Side Note: the Check connection button is broken and only works for the old cache server

    a. Open Unity 2019.3.0f1, Open preferences, select Cache server (global)
    b. Enter in ipaddress:10080, verify v2 is enabled, click "Check Connection" nothing happens.
    c. Close Preferences, and reopen, nothing displays.
    d. Shut down Unity, restart, go to preferences, "Connection Failed".
    e. Shut down Unity, delete library, restart, "Connection Failed", no "cache" dir on server
    f. Start old cache server on same machine as accelerator (separate install from accelerator)
    g. Restart Unity, "Connection Successful"
    h. Stop old cache server.
    i. Restart Unity, "Connection Successful"
    j. Stop accelerator
    k. Restart Unity, "Connection Successful", This is not working.

    Thanks

    Brian
     
  6. hiepu3d

    hiepu3d

    Unity Technologies

    Joined:
    Jul 1, 2017
    Posts:
    63
    @gp-lhota , sorry about the confusion regarding CacheDir. The CacheDir is where the folder “cache” will be created and on initial registration, this would be the same directory where the configuration and log files, .etc are stored. If you modify the configuration to change the value of CacheDir, the folder “cache” will be created in the new location. The folder “cache” is not created until the Editor writes data to the Accelerator. So, one way to test whether the Editor is actually working with the Accelerator is to check if the folder “cache” is created and if there is anything under that “cache” directory.

    For your connection with the Accelerator in the Hyper-V, I suspect there may be a connection issue between your local machine with the Hyper-V. There are some ways to test the connection to the Accelerator:
    • To test if you can connect to the Accelerator, you can send a request from your local machine to [Accelerator_IP]:[Accelerator_LastUsedHTTPPort]/api/health or [Accelerator_IP]:[Accelerator_LastUsedHTTPPort]/metrics. Here, Accelerator_IP could be the Hyper-V’s IP address and the ports can be found in the configuration.

    • To test if files can be written to the Accelerator, you can use Accelerator built-in tool to send a WRITE request to the running Accelerator:
    1. Running Accelerator in the Hyper-V
    2. Making sure accelerator is running by sending requests to the above endpoint from your local machine (not inside Hyper-V)
    3. To use the following tool, you would need to download Accelerator Executable for Windows to your local machine by following the PDF in this thread: https://forum.unity.com/threads/accelerator-documentation.789593/
    4. Use tool put command on local machine to send a file to the Accelerator.

      ./unity-accelerator tool put [Accelerator_IP]:[Accelerator_LastUsedProtobufPort] namespace key [ANY_TEXT_FILE]

    5. You can then use tool get command on local machine to fetch the content of the file and make sure there’s no difference.

      ./unity-accelerator tool get [Accelerator_IP]:[Accelerator_LastUsedProtobufPort] namespace key

    6. If you run Accelerator on Hyper-V with -debug flag, you should see debug log with messages “handled putRequest” and “handled getRequest” in the log file when you use the above tools to test sending files to Accelerator.
    If the above did not work for you and the Accelerator is running fine inside the Hyper-V (health and metrics endpoint are reachable), there may be some setup you need to do to allow your local machine to connect to applications running inside the Hyper-V with corresponding ports.

    Also, we have noticed that the Check connection button was not working and this should be fixed when 2019.3 is released.
     
  7. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
    Thx for effort, but unusable.
    No docs for unix.
    Can not even start and setup ports.
     
  8. emiliza_gutierrez

    emiliza_gutierrez

    Unity Technologies

    Joined:
    Sep 12, 2014
    Posts:
    25
    Hey @io-games, unfortunately we do not support Unix.

    Unity Accelerator currently supports:
    • Linux (Ubuntu 16.04, Ubuntu 18.04, or CentOS 7)
      For Linux you must install Acccelerator as a root user.
    • Windows Server 2008R2 / Windows 7 or higher (64bit)
    • Mac OS X 10.12 or higher (64bit)
    Thank for this feedback - we'll add it to future OSes to support.