Stacktical truly shines when integrated to your CI/CD pipeline. 

It's a great way to validate the scalability of your tech stacks and services before deploying fresh code and infrastructure changes in production.

This articles focuses on adding scalability testing to your Jenkins-powered CI/CD pipeline but it applies to CI softwares like Circle, Concourse and others.

A common CI/CD pipeline with the objective of testing for reliability could be:

  • A Pull Request with fresh code is available on Github
  • A build of the Github branch is automatically or manually triggered in Jenkins
  • The code undergoes Unit, Integration and E2E tests with Selenium
  • If it's a release branch, the code is deployed to the staging server
  • It undergoes Performance Testing with JMeter
  • Performance test results are formatted and sent to the Stacktical API*
  • A Stacktical scalability report is sent to your #devops Slack channel
  • The Pull Request is ready for QA

*If you don't do Performance Testing at you company and are unable to meet the data requirements of the Stacktical API call payload, the Stacktical Docker Application can do both a Performance Test and a Scalability Prediction in one go. 

We've got you covered.

Requirements

Software requirements:

  • An activated Stacktical account (sign up here if needed)
  • A Stacktical Tech Stack representing your project
  • A configured Service in your Stacktical Tech Stack
  • A running Jenkins 2.x server
  • Docker installed on the Jenkins server
  • The ability for the Jenkins user to run Docker commands directly or with sudo *
  • You have downloaded or are able to pull the Stacktical Docker Application

*For most platforms you can simply add the jenkins user to the docker group in /etc/group, but we suggest you Google the specific steps that may apply to your specific distribution.

Hardware requirements:

  • CPU: Intel(R) Xeon(R) CPU @ 2.60GHz
  • Memory: 2GB RAM
  • Bandwidth: A dedicated low latency / high bandwidth connection.
    It is important to be as close as possible to the target service to reduce latency.

Other

To continuously test the scalability of your application you need to have a staging environment that is identical to your production environment.

The Jenkins server also needs to be as close as possible to the tested service, ideally in the same datacenter, to avoid running into latency, bandwidth and other networking bottlenecks.

Lifting System Limits

Checking the number of maximum open file descriptors

Stacktical Willitscale needs to open multiple connections to be able to simulate hundreds of virtual users and load test your service. 

This CPU intensive operation requires a modification of the maximum number of open file descriptors of your system.

First check your effective limit with ulimit -a
Then check your maximum limit with cat /proc/sys/fs/file-max 

Now let's work on improving your effective limit while never going above your maximum limit.

Raising the number of open file descriptors

You can raise the maximum number of open file descriptors for your current terminal session using the following command :
ulimit -n {SOFT-FILE-MAX-VALUE}:{HARD-FILE-MAX-VALUE} 

e.g.
ulimit -n 32768 65536 

Again, your SOFT-FILE-MAX-VALUE and HARD-FILE-MAX-VALUE values must never be higher than the maximum number of open file descriptors allowed by your system.

If you want your modification to persist, you can add the following to your /etc/security/limits.conf :

* soft nofile {SOFT-FILE-MAX-VALUE}
root soft nofile {SOFT-FILE-MAX-VALUE}
* hard nofile {HARD-FILE-MAX-VALUE}
root hard nofile {HARD-FILE-MAX-VALUE}


A per our previous example, we recommend 32768 as a soft value and 65536 as a hard value (as long as they're not above your system limits).

Reboot your machine for the persistent changes to be effective.

Adding scalability testing to your Jenkins project

Docker Application parameters

If all requirements are met, the Tech Stack management screen should provide you with the credentials needed to use the Docker Application:

  • STACKTICAL_APPID 
  • STACKTICAL_APIKEY
  • STACKTICAL_SVCID  

They will help you run a load test and scalability test in one go with the Stacktical Docker Application.

Executing the Docker Application from Jenkins

Simply add the following Docker command to the Build Step  > Execute Shell section of an existing or a new Jenkins job:

docker run --rm \
  -e STACKTICAL_APPID={MY_TECH_STACK_APP_ID} \
  -e STACKTICAL_APIKEY={MY_TECH_STACK_API_KEY} \
  -e STACKTICAL_SVCID={MY_TESTED_SERVICE_ID} \
  --name stacktical-willitscale stacktical/willitscale:latest

Replace everything between  {} with your own parameters.

If the service you're testing requires BASIC AUTH, HTTP authentication you can provide your credentials using the following docker run option:

-e HTTP_AUTH={HTTP_AUTH_LOGIN}:{HTTP_AUTH_PASSWORD}

Once completed you will be able to view the scalability report of your build in the reports section of the Stacktical website. 

You will also receive a report summary on Slack if you have connected your Stacktical account to your Slack team (highly recommended).

Did this answer your question?