Skip to main content

What is Flexbench?

Flexbench is a fully customizable NodeJS script , generating simulated HTTP traffic. It can be used as a standalone script, as a desktop-app and as a server to simulate traffic with specific characteristics, such as read/write ratio, duration, number of requests to generate, in/out traffic throttling and more.

Features

Flexbench has lot of features to offer below are some of its core features

Clustering

By utilizing the NodeJS cluster module, the script can initialize a cluster of workers, each one simulating a batch of clients, taking full advantage of the hardware resources and paralellization. Each worker has its own process space and heap memory, keeping the batches of clients isolated from each other and using effectively all the cores of the system. Clients Each worker is responsible to create a batch of clients. The client will generate HTTP requests. Depending on the configuration, a client can generate requests for a specific duration, or a specific number, with customizable delays between them. Each client can create requests with a pipelined manner, meaning that the next request is created upon having the previous finished first. The pipelined configuration can also be disabled, having each client generating requests with specific delays, but not waiting for previous ones to finish first.

Delay between requests

Delay is a configured parameter and can be initialized with two ways: As a single value in milliseconds or a range between two values, selecting a random one between of them.

Throttling

Under specific scenarios, there is the need to throttle the generated traffic. This is supported by utilizing the ‘throttle-proxy’ NodeJS module with a few customizations. To throttle or not, is set by a configuration parameter for both inbound and outbound traffic, in bytes per second units. If enabled, a web proxy server is initialized on start (same number of proxies with workers), handling all the traffic generated both ways, applying a throttle policy on each request.

Duration of test

A test can be configured to run for a specific period or infinitively upon interruption. The configured value is set in seconds.

Number of requests

A test can be configured to run for a specific number of requests generated by all clients. The configured value is an integer value with the total number of requests all the clients should generate.

Statistics

Each worker is capable of collecting its own metrics on served requests. In this version the total number of responses with their codes is collected. When the test is finished all workers’ statistics are aggregated by the Master process and values are returned for further processing.

Deploying Flexbench

Flexbench can be deployed with different options and configurations.

Standalone Script

As standalone script through command line with arguments or to be included in another script. It has 3 main phases: Initialize – Run – Stop. For more details on how to write a simple request script have a look at Code Example.

Desktop App

A cross platform desktop app built with ElectronJs. It is an easy to use http traffic simulator app.

The purpose of desktop app is to provide user an easy to use GUI, with much more abstraction than using standalone script

User can save multiple scenarios with different request configuration. The scenarios can be exported as a flie with extention .flex and can be imported in other device that has flexbench desktop app installed.

what is scenario?

scenario is a list of configurations for generating simulated HTTP traffic. The configuration have the below options:

testDuration               - in seconds (-1 for infinite run)
workers - no. of workers (recomended to use equal the no. of cpus available)
clients - no. of clients to make request
throttleRequests_bps - in bps (-1 for no throttling)
randomDelayBetweenRequests - a random between each request eg.('0.5-1.1');

Features

  • create multiple projects
  • create multiple scenarios
  • create multiple requestes
  • run single / multiple scnearios
  • run single / multiple requestes
  • import / export scenarios
  • access to logs of every request

Server App

Server exposing REST apis for generating simulated HTTP traffic.

Something Missing?

If something is missing in the documentation or if you found some part confusing, please click on edit this Page and create a PR for improvement. We love your contribution!