Github Enterprise site load testing with Gatling

When I run Gatling test on Github Enterprise and inject more than 2000 users for 2 mins, the github site becomes unresponsive (unknown hostname error) but the maximum CPU hit is only up to 75 %. How can I reach the CPU up to 100 without crashing the site.
Please let me know in case any details required from my side.
Thanks

@Mohit sorry, but there’s not enough information so we can help you. Please check How to Ask a Question

Also, as you mentioned GitHub, is it the Self Hosted version, or the Cloud one?
Please beware to only load test applications and websites that you own.
DoS’ing someone else’s endpoints is in direct violation of our T&C. Large players such as GitHub have countermeasures to block you, but smaller ones don’t and you’ll hurt them.

Hi Slandelle,

I appreciate your reply.
Yes the github site is privately hosted on On-Prem servers. It’s not the cloud one.

Also is there any example of Load testing of Github API (Privately hosted one)? Please guide is there is any.
Thanks & Regards,
Mohit

“unknown hostname” is a DNS error. It means the hostname you have in your URLs cannot be resolved in the network the Gatling injector is. It could be a typo, or that your injector is in a different network that doesn’t know this hostname, eg trying to reach an intranet only hostname from the internet.

Hi Slandelle,

Almost 50% of the request triggered are getting successful. Rest are failing with unknown hostname. which might be because the site becomes unresponsive due to very high number of active users. But at the same time CPU utilisation is only up to 75 % which means there is something else which is causing the requests to fail. it might be http socket or something. I want to know is there any way I can achieve CPU 100% without crashing the http socket.
Hope I am able to clarify the situation here.
Thanks

CPU is not the only limiting factor. Also verify bandwidth.
And then you have to figure out the reason of those “unknown hostname” DNS errors. Could be also bandwidth.

Hi Slandelle,
Thanks for the reply.
I am trying to run gatling simulation from Codefresh. I am running below command in the command section of test stage of codefresh.
./gatling.sh -s GithubTest

GitHubTest.scala is my user defined simulations which is residing along with other default simulations in the directory “/opt/gatling/user-files/simulations”.

I am getting below error in codefresh output.

GATLING_HOME is set to /opt/gatling
05:17:12.654 [WARN ] i.g.c.c.GatlingConfiguration$ - Your Gatling configuration options are outdated, some properties have been renamed or removed.
Please update (check gatling.conf in Gatling bundle, or gatling-defaults.conf in gatling-core jar).
Enabled obsolete properties:
’gatling.http.ahc.requestTimeout’ was renamed into gatling.http.requestTimeout and will be removed in the next minor release. Please rename.
05:17:25.236 [ERROR] i.g.a.Gatling$ - Run crashed
java.lang.ClassNotFoundException: GithubTest
*** at java.net.URLClassLoader.findClass(URLClassLoader.java:382)***
*** at java.lang.ClassLoader.loadClass(ClassLoader.java:424)***
*** at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)***
*** at java.lang.ClassLoader.loadClass(ClassLoader.java:357)***
*** at java.lang.Class.forName0(Native Method)***
*** at java.lang.Class.forName(Class.java:264)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$2(Selection.scala:71)***
*** at scala.util.Try$.apply(Try.scala:210)***
*** at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:71)***
*** … 15 common frames omitted***
Wrapped by: java.lang.IllegalArgumentException: User defined Simulation class GithubTest could not be loaded
*** at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:80)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$4(Selection.scala:85)***
*** at scala.Option.orElse(Option.scala:477)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$3(Selection.scala:85)***
*** at scala.Option.flatMap(Option.scala:283)***
*** at io.gatling.app.Selection$Selector.singleSimulationFromConfig(Selection.scala:83)***
*** at io.gatling.app.Selection$Selector.$anonfun$selection$1(Selection.scala:52)***
*** at scala.Option.getOrElse(Option.scala:201)***
*** at io.gatling.app.Selection$Selector.selection(Selection.scala:44)***
*** at io.gatling.app.Selection$.apply(Selection.scala:36)***
*** at io.gatling.app.Runner.run0(Runner.scala:64)***
*** at io.gatling.app.Runner.run(Runner.scala:52)***
*** at io.gatling.app.Gatling$.start(Gatling.scala:80)***
*** at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)***
*** at io.gatling.app.Gatling$.main(Gatling.scala:37)***
*** at io.gatling.app.Gatling.main(Gatling.scala)***
Exception in thread “main” java.lang.IllegalArgumentException: User defined Simulation class GithubTest could not be loaded
*** at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:80)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$4(Selection.scala:85)***
*** at scala.Option.orElse(Option.scala:477)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$3(Selection.scala:85)***
*** at scala.Option.flatMap(Option.scala:283)***
*** at io.gatling.app.Selection$Selector.singleSimulationFromConfig(Selection.scala:83)***
*** at io.gatling.app.Selection$Selector.$anonfun$selection$1(Selection.scala:52)***
*** at scala.Option.getOrElse(Option.scala:201)***
*** at io.gatling.app.Selection$Selector.selection(Selection.scala:44)***
*** at io.gatling.app.Selection$.apply(Selection.scala:36)***
*** at io.gatling.app.Runner.run0(Runner.scala:64)***
*** at io.gatling.app.Runner.run(Runner.scala:52)***
*** at io.gatling.app.Gatling$.start(Gatling.scala:80)***
*** at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)***
*** at io.gatling.app.Gatling$.main(Gatling.scala:37)***
*** at io.gatling.app.Gatling.main(Gatling.scala)***
Caused by: java.lang.ClassNotFoundException: GithubTest
*** at java.net.URLClassLoader.findClass(URLClassLoader.java:382)***
*** at java.lang.ClassLoader.loadClass(ClassLoader.java:424)***
*** at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)***
*** at java.lang.ClassLoader.loadClass(ClassLoader.java:357)***
*** at java.lang.Class.forName0(Native Method)***
*** at java.lang.Class.forName(Class.java:264)***
*** at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$2(Selection.scala:71)***
*** at scala.util.Try$.apply(Try.scala:210)***
*** at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:71)***
*** … 15 more***
Reading environment variable exporting file contents.
Reading environment variable exporting file contents.
e[31m[SYSTEM] ***
*** e[31mMessagee[39m e[31mFailed to run freestyle step: Running teste[39m ***
*** e[32mCaused bye[39m Container for step title: Running test, step type: freestyle, operation: Freestyle step. Failed ***
*** with exit code: 1 ***
*** e[32mDocumentation Linke[39m Freestyle · Codefresh | Docs ***
*** e[32mExit codee[39m 1 ***
*** e[32mNamee[39m NonZeroExitCodeError

Please suggest what am i doing wrong here.
Thanks

There’s no way to tell without you providing more details on what you’re doing: shape of your code, packaging/build tool you’re using.

Enabled obsolete properties:
’gatling.http.ahc.requestTimeout’ was renamed into gatling.http.requestTimeout and will be removed in the next minor release. Please rename.

You seem to be using a very old version with an even older version of gatling.conf. You should upgrade.

Hi Slandelle,

Please find below my Dockerfile, User-Defined Simulation and Coidefresh yaml.

Dockerfile:
FROM ****************/openjdk:8-jdk-alpine

working directory for gatling

WORKDIR /opt

gating version

ENV GATLING_VERSION 3.5.1

create directory for gatling install

RUN mkdir -p gatling

RUN sed -i -e ‘s~http://dl-cdn.alpinelinux.org~https://artifactory.gcp.***/artifactory/alpinelinux~g’ /etc/apk/repositories

install gatling

RUN apk add --update wget bash libc6-compat && \

mkdir -p /tmp/downloads && \

wget -q -O /tmp/downloads/gatling-$GATLING_VERSION.zip \

https://artifactory.gcp.***/artifactory/maven-central/io/gatling/highcharts/gatling-charts-highcharts-bundle/$GATLING_VERSION/gatling-charts-highcharts-bundle-$GATLING_VERSION-bundle.zip && \

mkdir -p /tmp/archive && cd /tmp/archive && \

unzip /tmp/downloads/gatling-$GATLING_VERSION.zip && \

mv /tmp/archive/gatling-charts-highcharts-bundle-$GATLING_VERSION/* /opt/gatling/ && \

rm -rf /tmp/*

set directories below to be mountable from host

VOLUME ["/opt/gatling/conf", “/opt/gatling/results”, “/opt/gatling/user-files”]

set environment variables

ENV PATH /opt/gatling/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ENV GATLING_HOME /opt/gatling

change context to gatling directory

WORKDIR $GATLING_HOME

ENTRYPOINT [“gatling.sh”]

ENV GITHUB_HOSTNAME “githubqa.service.***”

ENV ORG_NAME “ghe-one-org”

ENV REPO_NAME “testsubdomain”

ENV GATLING_WORKDIR /opt/gatling

ENV CONCURRENT_USERS 3

ENV RAMP_UP_DURATION 30

WORKDIR $GATLING_WORKDIR

RUN rm -rf -R $GATLING_WORKDIR/user-files/simulations/

#RUN rm -rf $GATLING_WORKDIR/conf/

RUN ls -lrRt $GATLING_WORKDIR/user-files/simulations

#RUN mkdir -p $GATLING_WORKDIR/user-files && mkdir -p $GATLING_WORKDIR/conf && mkdir -p $GATLING_WORKDIR/results

COPY src/test/scala/simulations/GithubTest.scala $GATLING_WORKDIR/user-files/simulations/

COPY conf/* $GATLING_WORKDIR/conf/

RUN ls -lrRt $GATLING_WORKDIR/user-files/simulations $GATLING_WORKDIR/conf/

CMD ["-rd", “Run against ${GITHUB_HOSTNAME}”]

Simulations GithubTest.scala:

package simulations

import io.gatling.core.Predef.{rampUsers, _}
import io.gatling.http.Predef._

import scala.concurrent.duration._

class GithubTest extends Simulation {

	val GITHUB_HOSTNAME = sys.env("GITHUB_HOSTNAME")
	val ORG_NAME = sys.env("ORG_NAME")
	val REPO_NAME = sys.env("REPO_NAME")

	val baseUrl = s"https://${GITHUB_HOSTNAME}"
	val orgUrl = s"${baseUrl}/${ORG_NAME}"
	val repoUrl = s"${orgUrl}/${REPO_NAME}"


	val acceptHeader = Map("Accept" -> "application/json")

	val httpProtocol = http.baseUrl(repoUrl).headers(acceptHeader)


	val scn = scenario("Github Load testing")
	    .exec(http("Request").get("/"))

	setUp(
		//To ramp up users in a linear way for given duration
		//scn.inject(rampUsers(getConcurrentUsers()) during (getRampUpDuration() seconds))

		//To inject constant users per second for given duration
		scn.inject(constantUsersPerSec(getConcurrentUsers()) during (getRampUpDuration()))
         
		//To inject constatnt concurrent users for given duration
        //scn.inject(constantConcurrentUsers(getConcurrentUsers()).during(getRampUpDuration()))
	).protocols(httpProtocol)

	def getConcurrentUsers(): Int = {
		sys.env.get("CONCURRENT_USERS").getOrElse(1).toString.toInt
	}

	def getRampUpDuration(): Int = {
		sys.env.get("RAMP_UP_DURATION").getOrElse(30).toString.toInt
	}

}

Codefresh Yaml:

version: “1.0”

Stages can help you organize your steps in stages

stages:

  • “clone”
  • “build”
  • “test”

steps:
clone:
title: “Cloning repository”
type: “git-clone”
repo: “ex/ghe-load-testing”
# CF_BRANCH value is auto set when pipeline is triggered
# Learn more at Variables · Codefresh | Docs
revision: “${{CF_BRANCH}}”
git: “cf-github-utils”
stage: “clone”

build:
title: “Building Docker image”
type: “build”
image_name: “ex/ghe-load-testing”
working_directory: “${{clone}}”
tag: “${{CF_BRANCH_TAG_NORMALIZED}}”
dockerfile: “Dockerfile”
stage: “build”

test:
title: “Running test”
type: “freestyle” # Run any command
#image: “hub.artifactory.gcp./ubuntu:latest" # The image in which command will be executed
image: "engx.artifactory.gcp.
/ex/ghe-load-testing:${{CF_BRANCH_TAG_NORMALIZED}}”
working_directory: “${{clone}}” # Running command where code cloned
commands:
- “sh /opt/gatling/bin/gatling.sh -sf /opt/gatling/user-files/simulations/ -s GithubTest -rf /opt/gatling/results/”
- “cd /opt/gatling/conf”
- “ls -lrt”
stage: “test”

Please suggest now.
Thanks

As stated in the How to Ask a Question (already linked by @slandelle), you should ensure you use an up-to-date version.
Please upgrade!

Note: don’t forget to follow the migration guides for the different versions.

Hi,

Thanks for the reply.
I have updated the gatling version to 3.7.6. But I am still facing the same issue in codefresh pipeline. The dockerfile and other codes are same as in my last updated. Only change is that the version has been changed to 3.7.6 in dockerfile. Also I am using the default gatling.conf which comes as part of gatling bundle.
Please suggest what can i do to resolve the issue.
Thanks

CI and Docker integrations are things we provide in Gatling Enterprise.
You can build your own, but that’s not something we from Gatling Corp can’t help with (but maybe some external community member can).