Genvid Forum

Run encoding-worker on second machine


#1

Hello,

using the local installer, is it possible to use a second PC (e.g. a server standing in the office) as encoding-worker?

I know in the cloud it is definitely possible, but is there are solution without the cloud as well?

Our game is rather performance-intensive, and even powerful machines do have problems running the game at 60+ FPS while encoding (even encoding with 30FPS is a bit of a struggle). Normally, we do not have problems running the game at 200+ FPS in release-builds, so just setting up an encoding-server for genvid would probably be best. The server can run Windows and Linux both, and would be a dedicated machine.

In the terraform-directory I found the following segment:

  provisioner "remote-exec" {
    # Bootstrap script called with private_ip of each node in the clutser
    inline = [
      "python3 /tmp/services.py --toolbox ${basename(var.toolbox)} --name eworker-${count.index+1} --datacenter ${var.datacenter} --ip ${self.private_ip} --mode client --cluster ${var.cluster} --wan ${self.public_ip} --class encoding",
    ]
  }

Reading through services.py it installs the genvid toolbox on the encoding worker, and then joins the main cluster (somehow, I think by using genvid-services-systemd) as a client, which should be replicable under windows with genvid-services-local.

But how do I setup the local cluster on my machine that it accepts such connections, and how would the command-line look like on the encoding-worker?

If it is possible, it would be best (for us) to move away all services but web and game away from the development-machine.

Thank you for your help!


#2

A quick round up on one way to do it:

Setting up the bastion machine (that will be used as the encoder):

  1. Use Windows and install the SDK on the second server (we will call it the bastion).
  2. Set up the following environment variables:
  3. Start the Genvid Bastion (genvid-bastion install)
  4. Setup the services (genvid-sdk load-config-sdk).

Setting up the dev machine

  1. Setup the following environment variables:
  2. Access the Cluster UI (genvid-sdk monitor) and setup the services.
  3. Start the services in the UI or by using genvid-sdk start services.
  4. Run the game and web site directly (since the machine doesn’t run nomad, you cannot used the start job).

#3

I have a problem setting up the dev machine with this small guide:

Just setting the envrionment-variables doesn’t work out, it simply says that consul is not running (detailed log).

The RDP-Client is a connection to the bastion machine.

When I set GENVID_DEFAULT_IP on the dev machine as well, it seems to work however - I’ll report back if streaming works with this.


#4

While now some of the command-line tools work (genvid-sdk monitor for example), others only seem to work:

C:\Users\moritz\Desktop> genvid-sdk start services
INFO:sdk:Validating settings
INFO:sdk:Starting jobs for cluster local
INFO:cluster-api:Starting services

However, in the UI opened by monitor I cannot see services start. When I try to stop I actually get an error:

PS C:\Users\moritz\Desktop> genvid-sdk stop services
INFO:sdk:Stopping jobs for cluster local
INFO:cluster-api:Stopping services
404 Client Error: Not Found for url: http://192.168.178.27:8092/v1/proxy/local/cluster-api/v1/jobs/stop/services
        => Error Type: unknown
        => 404 page not found

  File "c:\users\moritz\appdata\local\programs\python\python35\lib\site-packages\genvid\toolbox\httpapi.py", line 62, in raise_http_error
    error.get("error", "Unknown error"), ex, response) from ex

In the UI in the browser I can start/stop just fine.

And when running the game, the following is logged:

I0221 18:11:40.118633  7744 Logging.cpp:52] Logger for C:\Users\moritz\source\repos\StatsHelix.Genvid\StatsHelix.Genvid.Client\bin\Debug\StatsHelix.Genvid.Client.exe initialized
I0221 18:11:40.119134  7744 genvid.cpp:142] Genvid SDK Initialization.
W0221 18:11:42.635781  7744 Logging.cpp:233] No NOMAD_ALLOC_ID env variable found.  Only default value of 'info' will be used.
I0221 18:11:42.636282  7744 AsyncConnections.cpp:47] Initialising.
I0221 18:11:42.636783  7744 NatsSession.cpp:135] NatsSession initialized.
I0221 18:11:42.637286  7744 AsioService.cpp:11] Starting I/O Service
I0221 18:11:42.637786  7744 StatsdClient.cpp:320] GENVID_STATSD_URL not found.
I0221 18:11:42.637786 13752 AsioService.cpp:33] I/O Service Started
I0221 18:11:42.637786 13752 AsioService.cpp:36] Executing I/O Service handlers
W0221 18:11:45.150035  7744 StatsdClient.cpp:339] Consul info not found.
I0221 18:11:45.150035  7744 AsyncConnections.cpp:89] StatsD using : 
E0221 18:11:45.150035  7744 AsyncConnections.cpp:94] StatsD client failed to initialise.
I0221 18:11:45.150035  7744 AsyncConnections.cpp:106] Starting the stream collector.
I0221 18:11:45.150509  7744 AsyncConnections.cpp:114] Stream collector started.
I0221 18:11:45.150509  7744 AsyncConnections.cpp:117] Starting.
I0221 18:11:45.150509   848 AsyncConnections.cpp:299] Reading configuration.
I0221 18:11:45.150509  7744 genvid.cpp:182] Genvid SDK Initialized.
I0221 18:11:45.157552  7744 AsyncConnections.cpp:720] Stream AUDIO created.
I0221 18:11:45.158030  7744 AudioGrabber.cpp:298] No GENVID_AUDIO_DEVICE variable found.
I0221 18:11:45.158030  7744 AudioGrabber.cpp:309] Using the default audio endpoint.
I0221 18:11:45.163043  7744 AudioGrabber.cpp:392] Audio Client Setup: {0.0.0.00000000}.{c5412c73-d518-4097-b65d-d0435204ebe6}? [2 channels f32le @ 48000 Hz]
I0221 18:11:45.163544  7744 AsyncConnections.cpp:720] Stream VIDEO created.
I0221 18:11:45.164546  7744 AsyncConnections.cpp:720] Stream ConnectedPlayers created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream RoundStatus created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream Score created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream Radar created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream Spectator created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream Defuser created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream Deaths created.
I0221 18:11:45.165048  7744 AsyncConnections.cpp:720] Stream RoundWinner created.
W0221 18:11:45.705986  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:11:47.662992   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:11:47.662992   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:11:47.662992   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:11:49.035228  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:11:50.174077   848 NatsSession.cpp:181] Connect failed to get servers from Consul.
E0221 18:11:50.174077   848 AsyncConnections.cpp:150] Failed to connect to message bus with error code : ConnectionFailed
W0221 18:11:52.369602  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:11:52.687722   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:11:52.687722   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:11:52.687722   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:11:55.702172  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:11:57.712889   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:11:57.712889   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:11:57.712889   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:11:59.036059  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
W0221 18:12:02.365468  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:12:02.739212   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:12:02.739212   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:12:02.739212   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:12:05.698469  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:12:07.763857   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:12:07.763857   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:12:07.763857   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:12:09.035378  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.

W0221 18:12:09.332801  7744 AsyncConnections.cpp:1217] Connection in progress, annotation on Deaths are dropped.
W0221 18:12:12.362449  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:12:12.795296   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:12:12.795296   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:12:12.795296   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:12:15.699851  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
E0221 18:12:17.823187   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:12:17.823187   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:12:17.823187   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:12:19.034337  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
W0221 18:12:22.362766  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.
The thread 0x1300 has exited with code 0 (0x0).
E0221 18:12:22.851047   848 genvid.cpp:389] Genvid_GetParameterInt() - genvid/encode/input/width error : Status Code: 0.
E0221 18:12:22.851047   848 genvid.cpp:456] Genvid_GetParameterInt() - Invalid parameter key 'genvid/encode/input/width' specified for stream 'genvid.kv'.
E0221 18:12:22.851047   848 AsyncConnections.cpp:430] Failed to get genvid/encode/input/width with error code : InvalidParameter
W0221 18:12:25.702548  4296 StreamCollector.cpp:399] Compose Session not connected.  Not all data will be send.

Is something missing on the dev-machine?


#5

Sorry, I mixed up the CONSUL_HTTP_ADDR, it shouldn’t contain an url, only IP and port.

Setting GENVID_DEFAULT_IP can be used as a fallback, but I don’t suggest to use it since it is main used is to set the service binding address.


#6

It’s working now, awesome! Thank you.

I’m at a much more comfortable 60-80% CPU now, instead of 85-100.