[google-appengine] min_instances, min_idle_instances, and old versions

2020-09-10 Thread Alan deLespinasse
First question: Is this accurate ? That 
is, if an auto-scaled service has min_instances set to nonzero, does that 
mean that instances in old versions don't get shut down when you deploy a 
new version? And those instances get billed?

I've been running a service with the following configuration (standard 
environment, Python 3.7):

runtime: python37
instance_class: F4
automatic_scaling:
  min_instances: 1
  max_instances: 10
inbound_services:
- warmup

New versions are deployed frequently because it's our integration 
environment. Apparently we've ended up with more and more instances 
running, because when we deploy a new version, the old version continues to 
exist and have 1 running instance. And apparently we're getting billed for 
these. I don't think I should have expected this, based on a close reading 
of the documentation 
.
 
(I have opened a billing support request, since I think it's Google's error 
in documentation, if not actually a bug.)

So now I'm trying to fix the configuration to avoid this. Based on the 
Server Fault article I linked above, I tried setting min_instances to 0 and 
min_idle_instances to 1. This seems to result in always at least 2 
instances running. I think maybe because one instance is getting requests 
(we have a once-a-minute cron job, among other things), so it's not "idle", 
so there has to be one more instance to have a minimum of one idle instance.

So I tried setting both min_instances and min_idle_instances to 0, but I 
*still* seem to always have at least 2 instances.

It's really hard to tell though, because the GCP console sometimes takes a 
bit to update, and maybe sometimes there are actually more instances than 
the configuration requires (I think maybe they're not always billed?).

So, second question: What is min_idle_instances actually supposed to mean? 
Is it the minimum number of instances, or is it the minimum number of 
"idle" instances, for some definition of "idle"? If an instance is serving 
1 simple query per minute, does that mean it's not idle, so there will be a 
second, idle instance? But then there are 2 instances, and if there are a 
few simple queries happening per minute, it seems like some might be 
randomly routed to each instance, so neither instance would be idle, and a 
third instance would get started.

Another complication: in our production environment, I increased 
min_instances to 2 because of this issue 
. 
It's pretty important that we always (>99.9% anyway) have at least 1 
running instance, since apparently there's no way to get instance startup 
time to less than 20-30 seconds, and to guarantee that, apparently we need 
2 instances running most of the time, because they can get preempted at any 
time without warming up a replacement first. So now I'm not sure whether to 
set min_idle_instances to 1 or 2 or what in production.

Do I need to set max_idle_instances? The documentation says its default 
value is "automatic", but doesn't say what that actually means.

I'm having a hard time figuring out these issues based on the documentation.

All I want is

   - Instances get shut down when I deploy a new version (I would have 
   thought this was always the case no matter what!)
   - Each of my environments normally just has 1 instance running, assuming 
   light traffic (1-10 queries per minute). Having 2 instances always running 
   in production is ok, if that's the only way to achieve the next point:
   - Never (or almost never) have zero instances running (aka almost never 
   have a query take more than 2 seconds because of warmup time)
   - Autoscale up to a reasonable maximum if traffic gets heavier

I didn't think this would be so difficult. I've been using App Engine for a 
long time, and thought I knew what I was doing, but I guess I've never used 
these options in the current environment (Python 3, standard).

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/84d8f642-3eae-4144-962e-71a1990dbbedn%40googlegroups.com.


[google-appengine] Re: Reach container/app by hostname

2020-09-10 Thread 'Jason' via Google App Engine
Hi,

The first way to do it is as you have already stated, exposing the 
deployment. The other way I recommend is using Istio [1]. Istio helps 
create a multi cluster mesh on a shared network to allow communication 
between the clusters. I would suggest reading the attached article and see 
if this can help in regards to your use case.

[1] https://istio.io/latest/docs/concepts/what-is-istio/

On Friday, August 14, 2020 at 10:28:08 AM UTC-4 luca...@icloud.com wrote:

> Hi There,
>
> I have 2 clusters: cluster A and cluster B. 
>
> I have an app A running on cluster A (docker container) and an app B 
> running on cluster B (docker container).
>
> All instances of app B needs to send messages (REST API) to app A and I 
> want that to be happening using the app hostname (the one google Kubernetes 
> assigns to each pod of a deployed app) but the host cannot be resolved 
> apparently because app A fails to reach app B using app B hostname.
>
> Any idea what I need to do here? Note that I can expose a load balancer 
> and that works BUT I really need to reach individual pods here.
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/cdc51599-157a-4d9f-aa88-65daef557da4n%40googlegroups.com.


Re: [google-appengine] Deploying Python Flask app to Google App Engine - version errors

2020-09-10 Thread 'Dustin Ingram' via Google App Engine
Using "python_version: 3.7" isn't valid, see
https://cloud.google.com/appengine/docs/flexible/python/runtime#interpreter

In addition, the version of pip that you're using in Cloud Shell doesn't
have an effect on the version of pip used when your application is deployed.

On Thu, Sep 10, 2020 at 8:20 AM Bjørn-Jostein Singstad <
bjorn_s...@hotmail.com> wrote:

> I am trying to deploy a Python Flask application on Google Cloud Platform
> (App Engine). The app works fine locally on my computer. I use Tensorflow
> version 2.3.0 in my app. This seems to be a problem when I try to deploy
> the app to Google Cloud Platform. I get this error code in the build log
> when trying to build the app:
>
>
> Collecting tensorflow==2.3.0 (from -r requirements.txt (line 2))
> Step #1:   Could not find a version that satisfies the requirement
> tensorflow==2.3.0 (from -r requirements.txt (line 2)) (from versions:
> 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0
> , 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1,
> 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1,
> 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0r
> c1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2,
> 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1,
> 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2,
> 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2,
> 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
> Step #1: No matching distribution found for tensorflow==2.3.0 (from -r
> requirements.txt (line 2))
> Step #1: You are using pip version 10.0.1, however version 20.2.3 is
> available.
> Step #1: You should consider upgrading via the 'pip install --upgrade pip'
> command.
> Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned
> a tanon-zero code: 1
> Finished Step #1
> ERROR
> ERROR: build step 1 "
> gcr.io/cloud-builders/docker@sha256:c1128bf8a32cfe4f2efcb920551a71a43d3401d3a3631f8b745e90b75099b68e"
> failed: step exited with non-zero status: 1
> Step #1:
>
>
> In my YAML file i have specified that the app should run on Python 3.7:
>
> entrypoint: "gunicorn -b:$PORT main:app"
> env: flex
> runtime: python
> runtime_config:
>   python_version: 3.7
>
> But for me it seems as python 2.7 also is involved in some way:
>
>  ---> Running in b2db92615defStep #1: Running virtualenv with interpreter
> /opt/python3.7/bin/python3.7Step #1: Using base prefix '/opt/python3.7'Step
> #1: */usr/local/lib/python2.7/dist-packages/virtualenv.py:1041:*
> DeprecationWarning: the imp module is deprecated in favour of importlib;
> see the module's documentation for alternative usesStep #1: import impStep
> #1: New python executable in /env/bin/python3.7Step #1: Also creating
> executable in /env/bin/python
>
> My requirement file looks like this:
> ```
> pip==20.2.3
> tensorflow==2.3.0
> Flask==0.11.1
> gunicorn==19.5.0
> numpy==1.17.4
> scipy==1.4.1
> h5py==2.10.0
> ```
>
>
> I tried to update pip in the Google Cloud Shell before deploying the
> application and it seems to work ok, but when I deploy my app it goes back
> to the old pip version.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/34417a89-10cc-440b-9821-65cf06d81422n%40googlegroups.com
> 
> .
>


-- 
Give me feedback: go/tell-dustin

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CAEODo7trCZrO5AK7MNZoT70cw7VFKUpAkCZcsZT074-A4Buaiw%40mail.gmail.com.


[google-appengine] Deploying Python Flask app to Google App Engine - version errors

2020-09-10 Thread Bjørn-Jostein Singstad
I am trying to deploy a Python Flask application on Google Cloud Platform 
(App Engine). The app works fine locally on my computer. I use Tensorflow 
version 2.3.0 in my app. This seems to be a problem when I try to deploy 
the app to Google Cloud Platform. I get this error code in the build log 
when trying to build the app:


Collecting tensorflow==2.3.0 (from -r requirements.txt (line 2))
Step #1:   Could not find a version that satisfies the requirement 
tensorflow==2.3.0 (from -r requirements.txt (line 2)) (from versions: 
0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0
, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 
1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 
1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0r
c1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 
1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 
1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 
1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 
1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
Step #1: No matching distribution found for tensorflow==2.3.0 (from -r 
requirements.txt (line 2))
Step #1: You are using pip version 10.0.1, however version 20.2.3 is 
available.
Step #1: You should consider upgrading via the 'pip install --upgrade pip' 
command.
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned 
a tanon-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 
"gcr.io/cloud-builders/docker@sha256:c1128bf8a32cfe4f2efcb920551a71a43d3401d3a3631f8b745e90b75099b68e"
 
failed: step exited with non-zero status: 1
Step #1: 


In my YAML file i have specified that the app should run on Python 3.7:

entrypoint: "gunicorn -b:$PORT main:app"
env: flex
runtime: python
runtime_config: 
  python_version: 3.7

But for me it seems as python 2.7 also is involved in some way:

 ---> Running in b2db92615defStep #1: Running virtualenv with interpreter 
/opt/python3.7/bin/python3.7Step #1: Using base prefix '/opt/python3.7'Step 
#1: */usr/local/lib/python2.7/dist-packages/virtualenv.py:1041:* 
DeprecationWarning: the imp module is deprecated in favour of importlib; 
see the module's documentation for alternative usesStep #1: import impStep 
#1: New python executable in /env/bin/python3.7Step #1: Also creating 
executable in /env/bin/python  

My requirement file looks like this:
```
pip==20.2.3
tensorflow==2.3.0
Flask==0.11.1
gunicorn==19.5.0
numpy==1.17.4
scipy==1.4.1
h5py==2.10.0
```


I tried to update pip in the Google Cloud Shell before deploying the 
application and it seems to work ok, but when I deploy my app it goes back 
to the old pip version.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/34417a89-10cc-440b-9821-65cf06d81422n%40googlegroups.com.