8000 Modify datastore sample for scale · petomalina/python-docs-samples@e80a979 · GitHub
[go: up one dir, main page]

Skip to content

Commit e80a979

Browse files
author
Jon Wayne Parrott
committed
Modify datastore sample for scale
1 parent 4626312 commit e80a979

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

appengine/flexible/datastore/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
runtime: python
22
env: flex
3-
entrypoint: gunicorn -b :$PORT main:app
3+
entrypoint: uwsgi --http-socket :$PORT --ini uwsgi.ini
44

55
runtime_config:
66
python_version: 3

appengine/flexible/datastore/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
app = Flask(__name__)
24+
ds = datastore.Client()
2425

2526

2627
def is_ipv6(addr):
@@ -35,7 +36,6 @@ def is_ipv6(addr):
3536
# [START example]
3637
@app.route('/')
3738
def index():
38-
ds = datastore.Client()
3939

4040
user_ip = request.remote_addr
4141

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Flask==0.12
22
google-cloud-datastore==0.23.0
3-
gunicorn==19.7.1
3+
uwsgi==2.0.15
4+
gevent==1.2.1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[uwsgi]
2+
wsgi-file=main.py
3+
callable=app
4+
# Socket listen queue size.
5+
listen=1000
6+
# 1 CPU core = 1 process.
7+
processes=1
8+
# 2000 gevent workers.
9+
gevent=2000
10+
# Disable request logging, nginx will do that
11+
disable-logging=1

0 commit comments

Comments
 (0)
0