Running Websocket client on Google Cloud

5/9/2018

I 'm working on a project that has a WebSocket client connected all the time with an API, just a single connection running forever, and I was wondering what the best way to keep this process running only one a single instance of the worker, thoughts?

-- Skhaz
google-cloud-platform
google-kubernetes-engine
kubernetes
websocket

2 Answers

5/9/2018

If you are running your code on app-engine than you probably could use manual scaling in case that you only need one instance.

https://cloud.google.com/appengine/docs/standard/python/an-overview-of-app-engine#scaling_types_and_instance_classes

-- Daniel Przybylowski
Source: StackOverflow

5/9/2018

One simple way of solving this problem is using Google Kubernetes Engine.

You will need to build a Docker container with your binary and create a short YAML manifest saying: this is my container, please always run one copy of it - this is called "Deployment" in Kubernetes terms.

Then you can forget about it - it will just run for you, surviving reboots, crashes, hardware malfunction and much more.

https://cloud.google.com/kubernetes-engine/docs/quickstart

-- Alexandr Lurye
Source: StackOverflow