# Github Enterprise site load testing with Gatling

**URL:** <https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652>\
**Category:** Gatling (Open-Source)\
**Created:** [April 7, 2022, 3:19am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652 "2022-04-07T03:19:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 7, 2022, 3:19am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/1 "2022-04-07T03:19:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 7, 2022, 8:15am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/2 "2022-04-07T08:15:07Z")

</div>

@Mohit sorry, but there’s not enough information so we can help you. Please check [How to Ask a Question](https://community.gatling.io/t/how-to-ask-a-question/6538)

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.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 7, 2022, 11:51pm UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/3 "2022-04-07T23:51:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 8, 2022, 5:47am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/4 "2022-04-08T05:47:04Z")

</div>

“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.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 12, 2022, 12:10am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/5 "2022-04-12T00:10:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 12, 2022, 5:40am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/6 "2022-04-12T05:40:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 20, 2022, 5:58am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/7 "2022-04-20T05:58:04Z")

</div>

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](https://codefresh.io/docs/docs/codefresh-yaml/steps/freestyle/) \*\*\*  
\*\*\* e[32mExit codee[39m 1 \*\*\*  
\*\*\* e[32mNamee[39m NonZeroExitCodeError**_

Please suggest what am i doing wrong here.  
Thanks

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 20, 2022, 6:43am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/8 "2022-04-20T06:43:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 20, 2022, 7:06am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/9 "2022-04-20T07:06:34Z")

</div>

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](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](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:**

```auto
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 [Bootstrap · Content moved](http://codefresh.io/docs/docs/codefresh-yaml/variables/)  
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

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [April 20, 2022, 7:29am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/10 "2022-04-20T07:29:07Z")

</div>

> [@Mohit](#):
>
> ```auto
> # gating version
> 
> ENV GATLING_VERSION 3.5.1
> 
> ```

As stated in the [How to Ask a Question](https://community.gatling.io/t/how-to-ask-a-question/6538) (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](https://gatling.io/docs/gatling/reference/current/whats_new/) for the different versions.

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://community.gatling.io/u/Mohit)\
**Post date:** [April 22, 2022, 3:34am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/12 "2022-04-22T03:34:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 22, 2022, 5:02am UTC](https://community.gatling.io/t/github-enterprise-site-load-testing-with-gatling/6652/13 "2022-04-22T05:02:48Z")

</div>

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).
