-1

I'm new to cloud programming but it's my understanding that the server I'm building can be run in multiple regions as multiple "instances" to improve user experience. In other words, my server code is just running on several different machines at once, all independently of each other. However, things like a database server for example should only be run as a single instance no matter how many server instances there are.

Is there a way to do this using Google App Engine? More specifically, is there a way to categorize portions of the project as scalable and others as non-scalable? My initial plan was simply to make two different projects - one which scales automatically and one which does not scale - and have them communicate through network requests. This could (potentially?) have the added benefit of spreading the resources used by my project across multiple cloud projects, reducing the per-project usage for billing purposes.

I'd love to know if I'm on the right track, or if what I'm doing is over-complicating things.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37

1 Answers1

0

Yes, this is possible, you will need to create 2 separate App Engine service and set one with automatic scaling and the other with manual scaling and setup how many instances you want for that service up and running all the time. You can read this documentation for more details on the types of scaling and this documentation on how to set this up in your app.yaml file.

That being said I don't think this will reduce your cost. In fact the opposite might happen, as App Engine is designed to reduce wasted resources as much as possible with auto scaling, and if you were to use Manual Scaling with a bigger load of instances than what you actually need you will be charged more for that, so you need to consider this into the design of your infra, I also recomment taking a look at the App Engine pricing documentation.

Ralemos
  • 5,571
  • 2
  • 9
  • 18
  • Thank you for the response. I should have worded my question differently, but I’ve already read through the linked documentation and am more concerned with if I *should* proceed with this pattern or if there is a simple solution I’m missing. Creating 2 projects seems like a hack to me, but maybe that’s just how it’s done. – Kevin Montambault Aug 26 '21 at 21:46
  • 1
    Well, your concern in mainly related to billing, right? If that is the case creating separate projects won't do much, as billing for GCP is not project based, but billing account based, [this documentation](https://cloud.google.com/billing/docs/concepts#billing_account) might help with that, if you want to mitigate costs you can use different [quotas](https://cloud.google.com/docs/quota) to your projects to limit your spending in each individual project, however, the free tier (which I assume you are using) applies to your billing account, or in other words, all your projects combined. – Ralemos Aug 27 '21 at 11:00
  • That definitely answers the question about billing. But the main question is surrounding how someone should manage processes that can not be duplicated (the stateful portion) with processes that should be duplicated (the stateless portion). – Kevin Montambault Aug 27 '21 at 20:08
  • I think I got your point, but just to clarify, you are considering this approach as you need 2 separate services in app engine and you are trying to check if you should create 2 separate projects for them, correct? If yes, then the answer is: not necessarily, you can deploy multiple independent services in app engine, both with they're own scaling strategy, you can check [this community answer](https://stackoverflow.com/a/44729749/12857703) for more details. Let me know if this answers your follow up question so I can add this to my answer. – Ralemos Aug 31 '21 at 11:47