Skip to content

Evaluation

Allan Kerr edited this page Apr 3, 2018 · 58 revisions

An Evaluation of Horizontal Scalability

Introduction

Literature Review

Background

Solution Description

Experimental Setup

The goal of the evaluation setup was to evaluate the Express platform in a production environment with realistic traffic. Because of this, an approach based on separating the Express cluster from the test driver was used.

Express Platform

The Express platform was deployed to a Kubernetes cluster with 1 to 8 machines each with their own dedicated resources. Having their own dedicated resources allows the Express services to be tested in a production environment.

Hardware

  1. Each machine in the cluster was a Compute Engine VM instance with 2 vCPU cores and 4 GB of memory in the us-central1-a zone.

Software

The machines running the Express platform met the following software requirements.

  1. Kubernetes 1.8.5. A Kubernetes cluster running version 1.8.5 deployed using Google Kubernetes Engine with master nodes isolated from worker nodes.
  2. Helm v2.8.0. The Helm server was initialized on the Kubernetes cluster using the Helm version v2.8.0.
  3. Express v1.0.0-alpha.1. The initial Express platform's alpha release was installed on the cluster.
  4. Test API v1.0. The test API developed to evaluate this project was deployed to the Express platform. The public v1.0 published to Docker Hub was deployed to the Express platform.

Test Driver

The test driver was run on a separate machine that communicates with the Express services over HTTP. Using this approach ensured that the test driver did not have any impact on the performance of the Express platform running on the cluster.

Hardware

  1. The test driver was run on a Google Compute Engine instance with 16 vCPU cores and 16 GB of memory in the northamerica-northeast1-a zone.

Software

The test driver was running the follow software:

  1. Bash 3.2.57(1)-release.
  2. Python 3.0.
  3. Locust v0.8.1. The public Locust v0.8.1 fork developed specifically for these experiments with support for additional data logging. This was run in distributed mode with 1 master and 16 slaves.
  4. Locustfile. The Locustfile developed to model multiple users interacting with the test API.

User Model

To use this approach to test the Express services, a user model must be created to simulate the HTTP requests that a user might send. This user must interact with the test API and authorization / identity service in a pattern that simulates real use. To achieve this, the following model was developed.

  • /searches/v1/list
    • Weight: 30
  • /campgrounds/v1/list
    • Weight: 30
  • /searches/v1/add
    • Weight: 15
  • /oauth2/login
    • Weight: 2
  • /oauth2/refresh
    • Weight: 2
  • /oauth2/register
    • Weight: 1

With this model, the simulated users register accounts, login, refresh their access token, list the available campgrounds, list their requested searches and add new searches. These requests are sent randomly; however, requests with higher weights are sent more frequently.

Common requests like listing the searches and campgrounds are weighted much higher to simulate a higher frequency. Logging in and refreshing a new token have much lower weights to reflect that they are performed less frequently. Registration occurs the least frequently; however, the simulated users must periodically re-register to avoid continually growing the list of searches which would skew latency due to the response size increasing as the test duration increases.

Experiment Preparation

All preparation was performed from the single machine the test driver is run on. The preparation assumes that the environmental needs in section 11 have been met. It is also required that the express-controller executable and Express v1.0.0-alpha.1 archive have been downloaded to the single test machine from the Releases section of the Express Github repository.

Cluster Reset

The Kubernetes cluster must be in a consistent state when starting each set of experiments. This can be accomplished by performing the following tasks. These tasks are only necessary if the testing tasks have already been performed on the cluster.

  1. Remove the previously deployed application using express-controller teardown testapi.
  2. Remove the Express environment from the cluster using helm delete terrifying-bronco.
  3. Remove all persistent volume claims using kubectl delete pvc terrifying-bronco-database-0.
  4. Remove all persistent volumes using kubectl delete pv terrifying-bronco-database-0.
  5. Wait until No resources found. is shown when using kubectl get pods.

Cluster Setup

The Kubernetes cluster must be prepared for running the testing tasks. This can be done by performing the following tasks.

  1. Navigate to the root directory of the Express v1.0.0-alpha.1 download in bash.
  2. Add the Express environment to the cluster using helm install --replace --name terrifying-bronco ./express/.
  3. Wait until all pods are ready when using kubectl get pods.
  4. Deploy the test CRUD API using express-controller deploy testapi allankerr/api --port 8080 --max X --endpoint-config ./containers/api/endpoints.yaml. The parameter max must be changed to the number of nodes in the cluster.
  5. Wait until all pods are ready when using kubectl get pods.
  6. Create a new admin OAuth2 client for the authorization service using ./bin/authorization-cli.sh client create admin demo-password.
  7. Add the user scope to the admin OAuth2 client using ./bin/authorization-cli.sh scope add admin user.
  8. Wait until the cluster is stable by ensuring the horizontal pod autoscalers do not have <unknown> targets when using kubectl get hpa.

Experiment Procedure

With the cluster fully configured for running the tests, the test procedure can be executed. This is handled by the Locust test driver by completing the following steps.

  1. Navigate to the /integration-testing directory of the Express v1.0.0-alpha.1 download in bash.
  2. Execute the command locust --host=https://<cluster-ip> substituting <cluster-ip> for the IP address or domain name of the the Kubernetes cluster being used.
  3. Open a web browser and navigate to http://localhost:8089.
  4. Enter 20,000 as the number of users to simulate and 1 as the hatch rate and click Start Swarming. The Locust test driver will now automatically perform the user simulation.
  5. The test driver should stopped when either of the cutoff criteria are met:
    • Average sliding-window response time. The average sliding-window response time exceeds 500 ms.
    • Request Failures. The proportion of failed requests exceeds 2%.
  6. After stopping the test driver, the statistics should be downloaded by going to the Locust download's tab in the web browser and downloading the following.
    • request statistics CSV
    • response time distribution CSV
    • exceptions CSV
  7. Save the statistics in a new directory along with a text document containing the number of machines in the cluster that the test was performed on.

Results

A simple linear regression was calculated to predict the platform's ability to handle requests based on the number of machines in the cluster. A significant regression equation was found with an R-squared of 0.98144. The model predicted the number of requests is equal to 62.171 + 21.176 (number of machines) where the number of machines is a discrete measure of the number of physical machines in the cluster. The number of requests increased 62.171 for each additional machine in the cluster.

Discussion

Future Work

Conclusions

Clone this wiki locally