Code Monkey home page Code Monkey logo

hammer_strike's Introduction

Hammer Strike

This is a demo that shows how fast App Engine can spin up instances to handle load that you send at it. It simulates a hammer strike game where you hit the pad with a hammer and ring the bell. This is another one of those demos that means to be a be both a web demo and a IoT assisted physical game.

Hammer Strike Screenshot

There is also an advanced version of it that allows you to send a configurable amount of traffic at App Engine to be a little more impressive.

Hammer Strike Advanced Screenshot

Getting Started

Create Project

  1. Create Project in Cloud Console
  2. Navigate to Compute Engine (to activate Compute Engine service)
  3. Navigate to the API Library and activate Container Builder API

Create Config

  1. Make a copy of /Samples.properties, renamed to/Makefile.properties
  2. Alter value for PROJECT to your project id
  3. Make a copy of /load/infrastructure/kubernetes/hammer-strike-deployment.sample.yaml, renamed to /load/infrastructure/kubernetes/hammer-strike-deployment.yaml
  4. Alter value for image to point to your project id

Build Load Infrastructure

  1. Open a terminal in /load/infrastructure/.
  2. Run make
  3. Open a terminal in /load/kubernetes/.
  4. Run make

Clean Up Load Infrastructure

You don't have to do this, but you might want to recreate the servers at some point.

  1. Open a terminal in /app/.
  2. Run make clean
  3. Open a terminal in /load/kubernetes/.
  4. Run make clean

Build Frontend Applications

  1. Open a terminal in /app/.
  2. Run make

Running the app

Assuming all has worked, you should be able to browse to https://[PROJECTID].appspot.com/ and you should see the carnival version of this application.

If you would prefer the advanced version, you can navigate to https://[PROJECTID].appspot.com/advanced.html.

Also note under folder demo there is a Makefile that can be used to illustrate that the frontend of the app is real. It calls gcloud commands to count and show the number of instances that are being used.

  • make list Show all of the instances.
  • make report Show all instances with how many requests they have served.
  • make count Show a quick count of how many instances there are.
  • make clean Delete all the running instances.

There is more information in the demo script.

General Architecture

The App consists of 3 App Engine Services and one Container Engine Cluster.

  • App Engine
    • distributor
      This service provides one endpoint for a frontend to sendload to App Engine. It handles dividing the load requested intoequal parts and sending it to each node of the GKE clusterfor throttling through GKE using Apache Bench.
    • load
      This service is the part of the application that receives and counts all of the load that the application handles.
    • ui
      This service is static hosting from the HTML/JS/CSS fronend for the application.
  • Container Engine
    • abrunner
      This application in a container uses Apache Bench to send load at load service from App Engine above.

API documentation

The front end of the application only hits one of the App Engine services in this application.

/hammer-strike/distributor/report

Parameters:

  • token: A key created by the client, that binds all of the traffic generated by this application into system. Allows the app to be able to be played by multiple clients at once, all with different sets of results.

This app call gets a list of what is happening with App Engine. It should contain total request ad instance counts, App Engine instance names and request counts. A successful request should look like this:


        {
            "request_count": 9960,
            "instance_count": 55,
            "instances": [{
                "name": "p7quc_00c61b117c51bd7c6ee9eb7b1d339b37f93f310aa5a88193edfde805f2df530b628a6c00a77c56",
                "requests": 94
            }, {
                "name": "p7quc_00c61b117cd17db1e069f166e71775f495eb1bd7a938441eae030957f80b28df7196f58246a6c124fbf65afdd0",
                "requests": 22
            },
            ...
            {
                "name": "p7quc_00c61b117c30a4881280a68d9db3c2aebb0fb05fc0247d263bc2e779e561e395692a409f89a2219b",
                "requests": 3
            }],
            "start": "1484349060671094892",
            "end": "1484349072133050210"
        }
/hammer-strike/distributor

Parameters:

  • token: A key created by the client, that binds all of the traffic generated by this application into system. Allows the app to be able to be playedby multiple clients at once, all with different sets of results.
  • n: The total amount of requests that you want to send at App Engine.

"This is not an official Google Project."

hammer_strike's People

Contributors

tpryan avatar

Watchers

Matt Gartner avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.