以有效安全的方式在正式生产环境中模拟真实流量进行全站点性能测试

发布于:2024-11-28 ⋅ 阅读:(30) ⋅ 点赞:(0)

What is EaseLoad

EaseLoad is a Cloud-Native performance test tool written in Go. EaseLoad aims to simulate real traffic for the whole site performance test in the production environment in an effective and safe way.

Product principle

  • Complete Safty. EaseLoad needs the o do the performance test in production. So, it could isolate the testing traffic, services, resources, middleware, and the data produced during the test to ensure there are no messed-up and minimal performance impacts for production.
  • Zero Source Code Changes: The EaseLoad is a non-intrusive design, there is no need for customers to change any source code. It can be easy to deploy and run with zero development cost.
  • Real Scenarios Simulation. Simulating the massive number of users who visit the site in parallel with the actual scenarios.
  • Easy & Reusable Test Cases. The test cases compose in a declared in YAML format, The test cases can be referenced and reused in different workflows during the life cycle of the testing product.
  • Fast Bottleneck Identifying. Leveraging the power of EaseMonitor, the test engine of EaseLoad per se is designed as a service, report metrics, tracing, and logs to EaseMonitor. EaseMonitor reports the whole invocation path and the possible bottlenecks.

Design principle

According to the product principle, the design principles are as below.

  • Cloud Native Compliance. To provide and perform perfect and safe performance, it must adopt the Cloud Native technologies and facilities, which could manage the whole service architecture - traffic, services, resources, middleware, and data.
  • Non-Intrusive Design. EaseLoad must adopt non-intrusive technologies, such as Service Mesh, JavaAgent, Service Proxy, Kubernetes, etc.
  • Declarative Performance Test. Defining the test case, workflow, and performance model in a declarative way. It’s clear and easier to be maintained by version control.
  • Handy Traffic Models. Provide enough useful traffic models and users can easy to combine them to do more complicated performance test
  • Performance Analytics. Not only report the throughput, latency, and errors but also can trace the latency for all services and identify the bottlenecks quickly.

Architecture

  1. Architecture overview of the EaseLoad testing tool
    在这里插入图片描述

    • TestCase: Manages the test case definition, verification, variable binding, and extracting. The test cases can be reused by different workflows.
    • Workflow: Manages the workflows. A workflow orchestrates a group of test cases, in series, parallel, loop, waiting, branching, etc. simulating the client’s visiting and decision making.
    • Traffich Model: Defines how the traffic bursts, drops, and how long to persist in each stage.
    • Report: reports the results for load tests.
    • Test Environment: Manage the testing service endpoints, variable definitions for different environments, such as the development, test, production environment.
    • Debug Runner: running single test cases, verify the request format, response, verification, and variables defined in the test case.
    • Cluster: EaseLoad employs ETCD to save the test load definitions, splitting and expanding to a group of test nodes.
    • LoadTest Engine: Running a load test, based on the specified workflows and traffic models.
    • Client Session: Represents a Web User-Agent, maintaining the cookies, workflow status, etc. A single test node can manage millions of clients by leveraging the goroutines and extending to tens of millions or more in the cluster mode.
    • Throttle: Controls the traffic burst or drop instantly according to the traffic model definitions. It also tunes the active available connections to avoid breaking extreme conditions.
    • Metric: Statistics and reports the metrics of the testing interfaces.
  2. Architecture overview of the EaseLoad full-chain performance test

    在这里插入图片描述

    By the support of MegaEase Cloud Native Platform. EaseLoad behaves as a downstream service to send performance testing requests to the target services.

    EaseLoad colors the traffic with testing labels, then MegaEase Cloud Native Platform is configured to route the product traffic, and testing traffic to isolated paths. The isolation is fulfilled on all levels, including:

    • ServiceMesh duplicates and isolates the service instances.
    • EasePlatform creates mirror instances for Redis, Kafka, ElasticSearch, MySQL DB and other middleware.
    • JavaAgent intercepts the requests sent to the middles and DB, changes the connections transparently, routes the colored traffic to the mirror instances.
    • EaseMonitor records metrics and traces with the coloring labels for comparing the normal product traffic and the performance testing traffic.

    All the actions, including mirror the instance, route the traffic between the service, route the request to the middleware, databases, are not required to change the source code or the normal configuration of the services. They are done by the platform without being intrusive.

Quick Start

The EaseLoad tool is delivered as a single executable binary. Currently supports Linux/amd64 and Windows/amd64.

  1. Download the latest version from https://github.com/co-megaease/easeload/releases.
  2. extract the binary to /var/tmp
% tar -zxf -C /var/tmp easeload.tar.gz

% cd /var/tmp
  1. Start Easeload Tool
% export ADDR=127.0.0.1
% export PORT=3000
% ./easeload-server

The logs output to the terminal shows things like :

Starting application at http://127.0.0.1:3000

  1. Open http://127.0.0.1:3000 in the Chrome browser. EaseLoad started successfully if this page presented:

    在这里插入图片描述

  2. Now we can create a single test to evaluate the EaseLoad performance test.

    1. Click the + on the left-top page, Creating a Workspace, let’s name the workspace as HelloEaseLoad.

    2. Click the Test Case button on the left sidebar, Creating a test case. Let’s send a request to query to the workspace list to this EaseLoad API per se.

      Method: GET EndPoint {{easeload-api}} Path: /v1/easeload/testspecs

    3. Click the Variable button on the left sidebar, filling values for the easelaod-api variable.

    4. Click on the Test Case Page again, Click send button to verify the case send successfully.

      {{easeload-api}}: http://127.0.0.1:3000

    5. Click the Workflow button on the left sidebar, adding a new workflow.

    6. Click the Traffic Model button on the left sidebar, adding a new workflow and adding the only test case to the workflow, selecting the traffic model type as Load Test.

    7. Click the Task button on the left sidebar to create a task and start the task.

    8. Click the Report button on the left sidebar to check the test result.

    在这里插入图片描述

Most of the fields in the page are easy to understand. Refer to EaseLoad User Manual for the detailed explanation of one item if needed.

Roadmap

Check EaseLoad Roadmap for details.

User Manual

Check EaseLoad User Manual for the details.