Code Monkey home page Code Monkey logo

gatling-mongodb-protocol's Introduction

gatling-mongodb-protocol

Codacy Badge License

MongoDB protocol for Gatling

Mongo protocol configuration

Example:

val mongoProtocol = mongo
  .uri("mongodb://username:password@host:port/database")
  • hosts: Array of string in format: "host:port"

  • authSource: The database source for authentication credentials.

  • authMode: The authentication mode. By default set to scram-sha1 for SCRAM-SHA-1. Can be configured with mongocr for the backward compatible MONGODB-CR.

  • connectTimeoutMS: The number of milliseconds to wait for a connection to be established before giving up.

  • maxIdleTimeMS: The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed.

  • sslEnabled: It enables the SSL support for the connection (true|false).

  • sslAllowsInvalidCert: If sslEnabled is true, this one indicates whether to accept invalid certificates (e.g. self-signed).

  • tcpNoDelay: TCPNoDelay boolean flag (true|false).

  • keepAlive: TCP KeepAlive boolean flag (true|false).

  • nbChannelsPerNode: Number of channels (connections) per node.

  • writeConcern: The default write concern (default: acknowledged). unacknowledged: Option w set to 0, journaling off (j), fsync off, no timeout. acknowledged: Option w set to 1, journaling off, fsync off, no timeout. journaled: Option w set to 1, journaling on, fsync off, no timeout.

  • readPreference: The default read preference (primary|primaryPreferred|secondary|secondaryPreferred|nearest) (default is primary).

  • failover: The default failover strategy. default: The default/minimal strategy, with 10 retries with an initial delay of 100ms and a delay factor of retry count * 1.25 (100ms .. 125ms, 250ms, 375ms, 500ms, 625ms, 750ms, 875ms, 1s, 1125ms, 1250ms). remote: The strategy for remote MongoDB node(s); Same as default but with 16 retries. strict: A more strict strategy; Same as default but with only 5 retries. :x: The definition of a custom strategy; delay: The initial delay as a finite duration string accepted by the Duration factory. retries: The number of retry (Int). factor: The Double value to multiply the retry counter with, to define the delay factor (retryCount * factor).

  • monitorRefreshMS: The interval (in milliseconds) used by the ReactiveMongo monitor to refresh the node set (default: 10s); The minimal value is 100ms.

For more information see the MongoDB connection options

Example:

val mongoProtocol = mongo
  .hosts("host1", "host2:port2")
  .username("usr")
  .password("pass")
  .database("database")

Mongo scenario definition

Execute custom command

  • command: the json string with raw mongo command

For more information see the MongoDB command api

all parameters support Expression

Example:

val scn = scenario("Mongo scenario")
    .exec(mongo("Custom command").command.execute("{\"aggregate\": \"collection\", \"pipeline\": [{\"$match\": {\"_field\": \"value\"}}]}"))

Execute count command

  • selector: the collection name
  • selector: the json string with mongo filter
  • limit : the maximum number of matching documents to count
  • skip : the number of matching documents to skip before counting
  • hint : the index to use (either the index name or the index document)

all parameters support Expression

Example:

val scn = scenario("Mongo scenario")
    .exec(mongo("count before").collection("messages").count().skip(5).limit(7).hint("{\"_id\": -1}"))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.