I have a long running app on appengine using py2.7. In the past I’ve used the smallest instance class, generally my app spins up about 10 instances to handle loads maxing out around 40requests a second.
Generally this cost me about $11 a day to run.
I’ve updated my code to py3, using cloud_ndb and a redis memcache. I noticed the python3 app consumes a lot more memory so I had to up the instance class to F2
On py2.7 my app size was about 107MB.. on py3 it’s 475mb (the F2 Instance Class maxes at 768 MB):
Here’s what my 10instances look like
The instances starts out already consuming a little over 600MB.. over time memory grows and I don’t know exactly why until I bump into a memory limit, the instance is killed. I need to track that down but from my knowledge I’m not doing anything to hold onto memory.. so wondering if there’s a memory leak somewhere that I’m not responsible for (the cloud ndb framework or something else)
Additionally these instances are only serving 4-5 requests a second… that seems really low and Id hope that I don’t need that many instances to server 40requests a second… my hope was with a higher instance class and python3 threading a single instance could handle much more. Obviously it probably depends on how expensive each request is. So yes they cost more which probably accounts for my increased costs but they are also faster, more mem, and hoped that fewer instances would be needed.
I’m curious if because I’m so close to the mem limit to start if appengine is leaning on that metric to decide to spin up more instances then maybe it really needs? I’m bumbed that a forced update to py3 has made things so much more expensive. I’m an indy developer so making the change directly takes a few $1000 out of my pocket to run my server.
Now that I’ve done this py3 conversion and I no longer rely on the standard env I’m considering moving the server over to something like linode to bring costs down (maybe). Obviously that’s a lot of work potentially and would love to avoid that if I can.
Any advice would be appreciated or if you need additional info
Thanks!