Skip to content

Instantly share code, notes, and snippets.

View jeanmarc's full-sized avatar

Jean-Marc van Leerdam jeanmarc

View GitHub Profile
@jeanmarc
jeanmarc / .readme.md
Last active February 28, 2022 13:32
Reusable connections in Gatling tests

Introduction

Gist explaining a way to add long-living connections to Gatling and create scenarios that reuse the connection(s) to put load on the target system.

I have used the gatling-kafka plugin available on GitHub as inspiration.

Note that the code snippets provided here do not complile right out of the box. You will have to add some dependencies, and code yourself to make things work.

<?php
$link = mysqli_connect("localhost", "root", "", "Mydb");
if ($link == = false) {
die("ERROR: Could not connect. "
.mysqli_connect_error());
}
$sql = "SELECT * FROM Data";
if ($res = mysqli_query($link, $sql)) {