Need Answers Fast
Need Answers Fast

Reputation: 67

How can I performance test a Postgres Database with Gatling?

I'm using Gatling to performance test an application, but the application has a Postgres database, which relies on jdbc to connect. Is it possible to run a scenario to test the database performance, and if so, how?

I found the jdbcFeeder, but I do not know how to execute the scenario I've set up, since the exec doesn't accept the url I provide it... jdbc:postgresql://host:port/database?user=<user>&password=<password>. It returns a java.lang.IllegalArgumentException: could not be parsed into a proper Uri, missing host.

Example:

val sqlQueryFeeder: RecordSeqFeederBuilder[Any] =
jdbcFeeder(connectionUrl, user, password, s"SELECT * FROM $schema.$table")

val scn: ScenarioBuilder = scenario("Test 1")
.feed(sqlQueryFeeder)
.exec(http.baseUrl(jdbc:postgresql://host:port/database?user=<user>&password=<password>))
)

setUp(scn.inject(atOnceUsers(100)))

Upvotes: 1

Views: 3401

Answers (1)

Shorn
Shorn

Reputation: 21476

Not out of the box.

jdbcFeeder is about driving performance tests with data read from a database (i.e. it's about "feeding" a test with data, not about testing a database).

The gatling-jdbc project appears to be intended to do what you want, but it didn't work when I tried it out (Gatling 3.0-RC4). I'm pretty new to Gatling and Scala, the problem might be me, or it might even by the Gatling release candidate - you might have better luck if you try it out.

There's also gatling-sql but I've not tried it out myself and it hasn't been touched in over a year.

Upvotes: 2

Related Questions