Skip to content

Add the performance testing code #603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 49 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,63 @@ jobs:
APPNAME: "projects-api"
steps: *deploy_steps

Connect-Performance-Testing:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: mvn dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}

- run: mvn verify

- store_artifacts:
path: target/jmeter/reports

workflows:
version: 2
build:
Connect Project Services:
jobs:
- test:
context : org-global
- deployDev:
context : org-global
requires:
- test
filters:
branches:
only: ['develop']
only: ['develop', 'connect-performance-testing']
- deployProd:
context : org-global
requires:
- test
filters:
branches:
only: ['master']
only: ['master']
- Hold [Performance-Testing]:
type: approval
requires:
- deployDev
- deployProd
- Connect-Performance-Testing:
requires:
- Hold [Performance-Testing]
153 changes: 153 additions & 0 deletions JMeter_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Performance Testing for Topcoder Connect App

## Description

Topcoder Connect is a web application that makes it easy to tap into the power of crowdsourcing to get more work done faster. Connect is ideal for projects that include application design and/or development work. You can crowdsource the entire application development lifecycle or just the specific stages where you need help. Common deliverables include application wireframes, UI/UX designs, prototypes, MVPs, and production-ready apps for any kind of device—mobile, wearables, or the web.

## Dependencies

- Jmeter maven plugin 2.9.0
- Maven 3.5.2
- JDK between 8 and 11

## Prerequisite

- We have already included the workflow into the circleci conf file with the usual dev builds.

## Directory Structure

- .circleci (Circleci configuration file)
- \src\test\jmeter - Includes the JMX file(s) and CSV data files
- pom file

### **Setup and Runtime**

Add the plugin to your project: Add the plugin to the build section of your pom's project

```
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
</plugin>
```

This simple load test is already integrated with the current build process

```
workflows:
version: 2
Connect Project Services:
jobs:
- build:
context : org-global
- deployDev:
context : org-global
requires:
- build
filters:
branches:
only: ['develop']
- deployProd:
context : org-global
requires:
- build
filters:
branches:
only: ['master']
- Hold [Performance-Testing]:
type: approval
requires:
- build
- deployDev
- deployProd
- Connect-Performance-Testing:
requires:
- Hold [Performance-Testing]
```

- Hold [Performance-Testing] - This is the approval job we needs manual interaction.
- It requires `build`, `deployDev` and `deployProd` jobs to run first.
- Actual performance testing job is `Connect-Performance-Testing` and it requires `Hold [Performance-Testing]` job to finish.

### **Configuration**

<img src="https://imgur.com/0WNB89y.png" alt="">
<img src="https://imgur.com/rdP3t77.png" alt="">

This performance test is for 15 virtual users. The parameters for this test plan is as below;

- Start Thread Count
- Initial Deplay, sec (Startup Time + Hold Load For)
- Startup Time, sec (Start Thread Count = Startup Time)
- Hold Load For, sec
- Shutdown Time (Next row `Initial Deplay`)

**Formulas:**

```
Initial time of a record = initialtime + start up time/ramp-up time + holdtime of the previous record
```

```
start up time/ramp-up time = Shutdown time/ramp-down time of the previous record
```

This setup is configured to run 6min with 15 UVs.

**Token Details**

- `audience` - https://m2m.topcoder-dev.com/
- `grant_type` - client_credentials
- `content-type` - application/json
- `client_id` - jGIf2pd3f44B1jqvOai30BIKTZanYBfU
- `client_secret` - ldzqVaVEbqhwjM5KtZ79sG8djZpAVK8Z7qieVcC3vRjI4NirgcinKSBpPwk6mYYP

To extract the token we are using the variable `access_token`

TO pass the `access_token` varaible globally we are using the beanshell Assertion

`${__setProperty(access_token, ${access_token})};`

**Random Controller**

We are using Random Controller to randomize the requests sent to the server to simulate the different request.

**Think Time**

We are using this parameter to implement a random wait time in betweent the request to simulate the real user experience.

**HTTP Requets**

- Access Tabs - Simulate user accessing different tabs
- Access Projects - Simulate user accessing different projetcs
- Assets Library (Link Insert) - Add Links to the projects

## Check the reports and data

After running the job using the circleci user can view the report by clicking on the Job: `Connect-Performance-Testing` > Artifacts > `target/jmeter/reports/15UV Ultimate Thread-Group/index.html`

eg: https://2728-60865675-gh.circle-artifacts.com/0/target/jmeter/reports/15UV%20Ultimate%20Thread-Group/index.html
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJhZG1pbmlzdHJhdG9yIl0sImlzcyI
```
It's been signed with the secret 'secret'. This secret should match your entry in config/local.js. You can generate your own token using https://jwt.io

## Performance Testing

- [Performance Testing Readme](README.md)

## Documentation

- [Projects Service Architecture](./docs/guides/architercture/architecture.md)
Expand Down
Loading