GithubHelp home page GithubHelp logo

bbigras / noisia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lesovsky/noisia

0.0 2.0 0.0 49 KB

Harmful workload generator for PostgreSQL

License: BSD 3-Clause "New" or "Revised" License

Makefile 3.05% Go 96.95%

noisia's Introduction

Noisia

Harmful workload generator for PostgreSQL.


Supported workloads:

  • idle transactions - transactions that do nothing during its lifetime.
  • rollbacks - transactions performed some work but rolled back in the end.
  • waiting transactions - transaction locked by other transactions and thus waiting.
  • deadlocks - simultaneous transactions where each hold locks that the other transactions wants.
  • temporary files - queries that produce on-disk temporary files due to lack of work_mem.
  • terminate backends - terminate random backends (or queries) using pg_terminate_backend(), pg_cancel_backend().
  • failed connections - exhaust connections pool (other clients can't connect to Postgres)
  • ...see built-in help for more runtime options.

Usage

Install golang, clone the repo and run make build. Check bin/ directory for noisia executable.

Using in your own code

You can import noisia and use necessary workloads in your code. Always use contexts to avoid infinite run. See tiny example below:

import (
  "context"
  "fmt"
  "github.com/lesovsky/noisia/waitxacts"
  "time"
)

func main() {
  config := &waitxacts.Config{
    PostgresConninfo:    "host=127.0.0.1",
    Jobs:                 2,
  }

  ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second)
  defer cancel()

  w := waitxacts.NewWorkload(config)
  if err := w.Run(ctx); err != nil {
    fmt.Println(err)
  }
}

TODO/Ideas:

  • sequential scans

Disclaimer

ATTENTION: USE ONLY FOR TESTING PURPOSES, DO NOT EXECUTE NOISIA AGAINST PRODUCTION, RECKLESS USAGE WILL CAUSE PROBLEMS.

DISCLAIMER: THIS SOFTWARE PROVIDED AS-IS WITH NO CARES AND GUARANTEES RELATED TO YOUR DATABASES. USE AT YOUR OWN RISK.

License

BSD-3. See LICENSE for more details.

noisia's People

Contributors

lesovsky avatar zachvalenta avatar

Watchers

James Cloos avatar  avatar

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.