Skip to content

Lightweight and versatile performance/load testing framework

License

Notifications You must be signed in to change notification settings

crtomirmajer/midge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

midge

Lightweight, protocol agnostic, versatile performance testing framework, that can be used to test HTTP servers, gRPC services, databases and much more!

Install

Using pip:

pip install git+https://github.com/crtomirmajer/midge.git

Commands

run performance test:

midge run performance_test.py

analyze results:

midge analyze dummytest.log

Core concepts

  • midge.Midge represents a single agent (user) on a target system;
  • midge.action contains the logic for executing single action on the target system (typically hitting one endpoint);
  • <Task> definition of a performance test, consisting of multiple actions and executed by multiple agents;
  • midge.swarm is a pool of agents executing a provided task concurrently;

Examples

HTTP

import aiohttp

import midge
from midge import ActionResult


@midge.swarm(
    population=10,
    rps=100,
    total_requests=5000,
)
class DummyTask:
    url = 'https://somewhere.on.the.webz'

    async def setup(self):
        self.session = aiohttp.ClientSession()

    @midge.action()
    async def get_profile(self) -> ActionResult:
        async with self.session.get(f'{self.url}/profile') as response:
            return await response.text(), True

    @midge.action()
    async def get_time(self) -> ActionResult:
        async with self.session.get(f'{self.url}/time') as response:
            return await response.text(), True

    async def teardown(self):
        await self.session.close()

About

Lightweight and versatile performance/load testing framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages