Skip to content Skip to sidebar Skip to footer

Python App Engine Webapp2 Slow To Route

I have a Python App Engine application which serves about 3M requests per day. I am trying to optimize the app to save on my ridiculously ballooned hosting bill. November, App Engi

Solution 1:

If keeping the instance hours tab low is of higher interest that keeping the request latency low then maybe you can drop the automatic scaling in favour of basic scaling. From Scaling types and instance classes:

Basic Scaling

A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity.

Automatic Scaling

Automatic scaling is based on request rate, response latencies, and other application metrics.

Automatic Scaling targets a better user experience and can launch a large number of instances based on the incoming traffic patterns.

There are config parameters that you can use to tune the scaling behaviour, but for automatic scaling fundamentally there isn't one limiting the number of instances running in parallel, which can lead to balooning instance hours. BTW, your min_idle_instances: 1 will pretty much keep alive an instance at all times, almost always idle (other instances will actually handle the bulk of the requests).

Basic scaling on the other hand has a max_instances config which can be used to effectively cap the bill's instance hours:

max_instances

Required. The maximum number of instances for App Engine to create for this service version. This is useful to limit the costs of a service.


Post a Comment for "Python App Engine Webapp2 Slow To Route"