Gatling DB tests

1,232 views
Skip to first unread message

Abhinav Gogna

unread,
Mar 19, 2015, 6:16:44 PM3/19/15
to gat...@googlegroups.com
I know gatling currently does not support database performance tests yet but I came across this repo https://github.com/senkadam/gatlingsql on github. Was wondering if anyone used it or have any suggestions?

Thanks,
Abhi

Stéphane LANDELLE

unread,
Mar 20, 2015, 6:10:59 AM3/20/15
to gat...@googlegroups.com
This project looks like a good start. Kudos to Adam!

IMHO, it lacks 2 things:

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhinav Gogna

unread,
Mar 20, 2015, 11:20:00 AM3/20/15
to gat...@googlegroups.com
Stephane,

Thanks for your input. We have a need for DB performance test (all select statements). Do you think this can be used as is for some smaller simulations (20-30 users)? I emailed Adam to get some pointers. Waiting for his response.

Thanks,
Abhinav 

Stéphane LANDELLE

unread,
Mar 20, 2015, 11:22:59 AM3/20/15
to gat...@googlegroups.com
The coordinated omission issue is a structural one. It's not related to the load.

Stéphane Landelle
Lead developer


Abhinav Gogna

unread,
Mar 20, 2015, 3:28:40 PM3/20/15
to gat...@googlegroups.com
Thanks Stephane. I am having little trouble implementing this protocol. I don't know how to get the response object. Also, I tried it with incorrect credentials but the test still passed. Can you tell how I can fix this. Here is the simulation code:

package cz.senkadam.gatlingsql.requests

import akka.actor.{ActorRef, Props}
import io.gatling.core.Predef._
import io.gatling.core.action.Chainable
import io.gatling.core.action.builder.ActionBuilder
import io.gatling.core.config.Protocols
import io.gatling.core.result.message.{KO, OK}
import io.gatling.core.result.writer.{DataWriter, RequestMessage}
import scala.concurrent.duration._

class DBSimulation extends Simulation{

  val mine = new ActionBuilder {
    def build(next: ActorRef, protocols: Protocols) = {
      system.actorOf(Props(new RunSql(next)))
    }
  }

  val scn = scenario("SQL load test")
    .repeat(2) {
    exec(mine)
  }

  setUp(scn.inject(atOnceUsers(1)))

  class RunSql (val next: ActorRef) extends Chainable {
    def begin(session: Session) {
      val delegate = new SqlBuilderSpec
    }

    def execute(session: Session) {
      var start: Long = 0L
      var end: Long = 0L
      var status: Status = OK
      var errorMessage: Option[String] = None
      try {
        start = System.currentTimeMillis;
        begin(session)
        end = System.currentTimeMillis;
      } catch {
        case e: Exception =>
          status = KO
          errorMessage = Some(e.getMessage)
          logger.error("ERROR", e)
      } finally {
        val requestStartDate, requestEndDate = start
        val responseStartDate, responseEndDate = end
        val requestName = "Test Scenario"
        val message = errorMessage
        val extraInfo = Nil
        DataWriter.dispatch(RequestMessage(
          session.scenarioName,
          session.userId,
          session.groupHierarchy,
          requestName,
          requestStartDate,
          requestEndDate,
          responseStartDate,
          responseEndDate,
          status,
          message,
          extraInfo))
        next ! session
      }
    }
  }
}

Abhinav Gogna

unread,
Apr 2, 2015, 4:34:37 PM4/2/15
to gat...@googlegroups.com
So Adam helped me with this. He has updated hit github repo with new commits that also include default simulation. I am using it on couple of my projects and so far have not found any issues. If anyone wants to use Gatling for DB tests, this is a very handy library.

Please spread the word. :)
Reply all
Reply to author
Forward
0 new messages