diff --git a/appengine/taskqueue/counter/README.md b/appengine/taskqueue/counter/README.md
new file mode 100644
index 000000000000..4ccee7143a01
--- /dev/null
+++ b/appengine/taskqueue/counter/README.md
@@ -0,0 +1,8 @@
+# App Engine Task Queue Counter
+
+
+These samples are used on the following documentation page:
+
+> https://cloud.google.com/appengine/docs/python/taskqueue/overview-push
+
+
diff --git a/appengine/taskqueue/counter/app.yaml b/appengine/taskqueue/counter/app.yaml
new file mode 100644
index 000000000000..e2b5e55709c0
--- /dev/null
+++ b/appengine/taskqueue/counter/app.yaml
@@ -0,0 +1,11 @@
+runtime: python27
+api_version: 1
+threadsafe: true
+
+handlers:
+- url: /.*
+ script: main.app
+
+libraries:
+- name: jinja2
+ version: 2.6
diff --git a/appengine/taskqueue/counter/counter.html b/appengine/taskqueue/counter/counter.html
new file mode 100644
index 000000000000..a9f6a39d3609
--- /dev/null
+++ b/appengine/taskqueue/counter/counter.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+{% for counter in counters %}
+-
+ {{counter.key.id()|e}}: {{counter.count|e}}
+
+{% endfor %}
+
+
diff --git a/appengine/taskqueue/counter/main.py b/appengine/taskqueue/counter/main.py
new file mode 100644
index 000000000000..b25570bf1a1d
--- /dev/null
+++ b/appengine/taskqueue/counter/main.py
@@ -0,0 +1,62 @@
+# Copyright 2016 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# [START all]
+import os
+
+from google.appengine.api import taskqueue
+from google.appengine.ext import ndb
+import jinja2
+import webapp2
+
+
+JINJA_ENV = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
+
+
+class Counter(ndb.Model):
+ count = ndb.IntegerProperty(indexed=False)
+
+
+class CounterHandler(webapp2.RequestHandler):
+ def get(self):
+ template_values = {'counters': Counter.query()}
+ counter_template = JINJA_ENV.get_template('counter.html')
+ self.response.out.write(counter_template.render(template_values))
+
+ def post(self):
+ key = self.request.get('key')
+ if key != '':
+ # Add the task to the default queue.
+ taskqueue.add(url='/worker', params={'key': key})
+ self.redirect('/')
+
+
+class CounterWorker(webapp2.RequestHandler):
+ def post(self): # should run at most 1/s due to entity group limit
+ key = self.request.get('key')
+
+ @ndb.transactional
+ def update_counter():
+ counter = Counter.get_or_insert(key, count=0)
+ counter.count += 1
+ counter.put()
+ update_counter()
+
+
+app = webapp2.WSGIApplication([
+ ('/', CounterHandler),
+ ('/worker', CounterWorker)
+], debug=True)
+# [END all]
diff --git a/appengine/taskqueue/counter/main_test.py b/appengine/taskqueue/counter/main_test.py
new file mode 100644
index 000000000000..6facb14b0437
--- /dev/null
+++ b/appengine/taskqueue/counter/main_test.py
@@ -0,0 +1,29 @@
+# Copyright 2016 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from google.appengine.ext import ndb
+import main
+import webtest
+
+
+def test_app(testbed, run_tasks):
+ key_name = 'foo'
+
+ app = webtest.TestApp(main.app)
+ app.post('/', {'key': key_name})
+ run_tasks(app)
+
+ key = ndb.Key('Counter', key_name)
+ counter = key.get()
+ assert counter.count == 1
diff --git a/appengine/taskqueue/counter/queue.yaml b/appengine/taskqueue/counter/queue.yaml
new file mode 100644
index 000000000000..97a10dfa9f53
--- /dev/null
+++ b/appengine/taskqueue/counter/queue.yaml
@@ -0,0 +1,4 @@
+queue:
+# Change the refresh rate of the default queue from 5/s to 1/s
+- name: default
+ rate: 1/s