1

Somewhat speculative, I use the GAE Flexible Environment to run a WebSocket nodejs server but noticed that the targeted routing feature of Standard Evironment is not available in the Flexible Evironment, even when using Manual Scaling. I need the ability to direct multiple players to the same instance. So sticky sessions does not solve my case.

It is stated here: enter link description here In the comment:

Note: In the flexible environment, targeting an instance is not supported. It is not possible to send requests directly to a specific instance.

There is not explaination to why or if this is just a current work in progress. Seems very odd to me.

Is there a known plan or road map from Google for GAE?

Or is there a better fit that does not force me to manage actual VMs?

Many thanks.

JGoodgive
  • 1,068
  • 10
  • 20

2 Answers2

0

Google didn't make any official announcements about supporting instance targeting in GAE flexible environment the way it's done in the standard one, so far.


A possible solution, however, would be to enable session affinity, which should allow the App Engine to send requests by the same user to the same instance. For that, you will need to add the following lines to your app.yaml file:

network:
  session_affinity: true

There are few things that you should keep in mind when enabling session affinity in GAE though:

  1. Your app must always be tolerant of session affinity interruptions. Partially, because the GAE flexible instances are restarted weekly.
  2. Enabling session affinity can also limit the effectiveness of App Engine's load balancing algorithms and can cause your instance to become overloaded.
  3. Session affinity in App Engine is implemented on a best-effort basis, thus it is always safer to assume that session affinity is not guaranteed.

Also,

Because session affinity isn't guaranteed, you should only use it to take advantage of the ability of socket.io and other libraries to fall back on HTTP long polling in cases where the connection is broken. You should never use session affinity to build stateful applications.

Please review the GCP documentation on session affinity for more details.


Other than that, I don't think the GAE flexible can offer aything else for your use case, and it may indeed be more appropriate to use a GCE VM.

Deniss T.
  • 2,526
  • 9
  • 21
  • Thank you, but as i wrote, session affinity does not solve my issue as i need ro have groups of players together. – JGoodgive Mar 24 '21 at 20:20
0

From what you describe, this functionality from Google App Engine Standard is what you are most interested in using:

If you are using manually-scaled services, you can target and send a request to a instance by including the instance ID.

Are you limited to use just one App Engine?

I will only use GAE Flex if my application needs a custom CPU, more RAM, a specialised third-party library or program. I use the GAE standard environment most of the time because GAE flex can provide complementary additions when I need them.

For example, you can implement a micro-service that utilise the specific parts of each App Engine. If you want to target a specific instance, use GAE Standard and route any custom processing to the flexible environment. You will probably find that this is a more cost-effective method for implementing your application:

Intended to run for free or at very low cost, where you pay only for what you need and when you need it. For example, your application can scale to 0 instances when there is no traffic.

Depending on how you have designed your application, you could use a Global Load Balancer to integrate these services. You can then distribute your players to various back-end options or a single instance if you use GAE Standard.

Andrew
  • 795
  • 4
  • 18
  • Thanks for answering, and excuseme for not replying for like for ever. But yes thats the functionality I am looking for. I cannot use Standard since it is not guaranteed to be up for the entire session that players might be playing. I am using the service for realtime updates thus it would suck if it went down suddenly. Manual scaling + targeted instances would let me distribute load intelligently. The only other option is going kubernetes but then I loose the whole node-as-a-service service. – JGoodgive Jan 15 '22 at 15:07