2

I am working with socketIO + Nodejs over gcloud app-engine with managed vms. I am facing a problem that when I use manual scaling, the gcloud working well with sockets.

But when I use dynamic scaling, sockets not working at all, I think it doesn't work because of the port forwarding problem with two instances! here's my app.yaml instances handling that works.

 manual_scaling:
  instances: 1

 resources:
  cpu: 0.1
  memory_gb: 0.1
  disk_size_gb: 10

When I remove them, sockets not works at all. Is there's any recommendation or a work around. As I am going to serve a very large number of socket requests (2 million/day). If no work around found. What is the specs that I should use for one instance to handle all of these requests, or how can I calculate them?

Thanks.

4

1 回答 1

1

Google Cloud 本身不支持负载平衡的网络套接字。您可以使用一些选项来解决此问题。

一种选择是将 websocket 流量直接路由到 VM 实例,而不是通过云负载均衡器。您可以在此处查看执行此操作的示例:

https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/websockets

这会起作用,但你应该知道缺点:

  • 它本身不适用于 HTTPS
  • 托管 VM 中的 VM 实例每周回收一次,从而导致连接断开。

另一种选择是使用 pubnub 或 pusher 等第 3 方服务:

祝你好运!

于 2016-02-16T07:02:35.713 回答