Microservices and instance costs

51 views
Skip to first unread message

Richard Cheesmar

unread,
Aug 20, 2018, 8:30:24 AM8/20/18
to Google App Engine

Regarding App Engine Microservice costs, in the Google docs, it states the following

Costs for instance-hours (the CPU and memory for running your code) are not separated for services; all the instance-hours for an entire project are lumped together.

Can anyone tell me if this implies that for example there is n instances on a project that are shared across all microservices or does each microservice have a separate instance that is charged at a base rate and then on top instance hours used.

Thanks

Ani Hatzis

unread,
Aug 20, 2018, 11:11:16 AM8/20/18
to Google App Engine
Hi Richard,

instances are not shared across services, each service has its own instances (you can define different scaling and instances classes per service).

In your billing, you will not see the instance hours broken down to services, but for all services of the project together.

This also means that if you have low traffic per service you may see under-utilization of instances, compared to a monolithic app with just one service.

Hope that clarified it a little.
Ani

Richard Cheesmar

unread,
Aug 20, 2018, 11:29:03 AM8/20/18
to Google App Engine
Hi, Ani,

Thanks for reply, but does that mean I am therefore paying the base cost for each instance of each service on top of instance hours.

Ani Hatzis

unread,
Aug 20, 2018, 2:02:02 PM8/20/18
to Google App Engine
Hi Richard,

I'm not sure I understand what you mean by "base costs" and "on top of instance hours". In standard environment you pay for instance hours in the App Engine sandbox, and as they can scale down to 0 instances, and 28 hours of F1 are free per day, you may even pay nothing. In flexible environment you pay for the virtual machines used by your app. I was referring to standard environment.

The price for every instance is a multiple of the cheapest class (F1/B1), e.g. F2/B2 costs twice as much as F1/B1. But in your billing, all instance hours are converted to F1/B1 hours and billed with $0.05 per hour.

You probably expect your bill to look like this for all services in this app:
  • 10 instance hours F1 x $0.05 = $0.50
  • 3 instance hours F2 x $0.10 = $0.30
But your billing will actually show all classes converted to F1/B1. 1 hour of F2 equals 2 hours of F1:
  • 16 instance hours x $0.05 = $0.80
Whether you use one service or multiple services doesn't change the pricing. But there can be cases where your app may consume more instance hours because the instances can't be shared across all services.

Service 1: has one instance of F1 running 24/7, and handles the low traffic coming to it. That's 24 hours.
Service 2: performs a job every 1 hour and thus needs to spin up its own F1 instance occasionally, that's another few hours per day.

If you would have a monolithic app (i.e. 1 service), all request handlers would be available in the same instance, and thus the chances are better that you would get away with a single instance for everything together. Hence the better utilization of available (and billed) instances.

But there can be also other cases, where using multiple services would save you cost. For example if only a few request handlers (e.g. background tasks) need 1GB memory, then you would put them into their own service with a bigger class and put all other handlers into a separate service with a cheaper instance class, rather than serving everything with the expensive class.

Either way, for billing all instance hours in your app are lumped together and converted to F1/B1 prices. In this regard, think about the services like having multiple "apps" billed together in the same project.

Well, this explanation hopefully didn't make it worse for you 🙂Just ask again.
Best,
Ani

Richard Cheesmar

unread,
Aug 20, 2018, 2:34:22 PM8/20/18
to Google App Engine
Hi, Ani,

Thanks mate, just the job.
Reply all
Reply to author
Forward
0 new messages