npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tank.bench-profile

v1.0.2

Published

Creates profiles for the Tank.bench-common

Downloads

1

Readme

Tank.bench-profile

npm version

What is it?

Tank.bench-profile is a part of MixBytes.Tank -
the ultimate tool for testing blockchain performance.

This project contains types and functions that will help you to create profiles to run them via Tank.bench-common

Please see Tank.bench-common to find out compatible versions of these projects.

You can find the boilerplate of profile here

What is profile?

Profile is a node.js JavaScript/TypeScript project, that contains package.json file with dependencies and at least one entrypoint code file, that exports object created with the Profile function.

Profile can be compiled with Tank.bench-profile-compiler. It creates single js file that is called the Compiled profile.

Profile can be run with Tank.bench-common. It can run compiled profiles, or non-compiled profiles.

Creating profiles

To create profile you should create new node.js project with the command npm init.

Than, you should install tank.bench-common dependency to be able to run and debug your profile. To do it, just use npm install --save-dev tank.bench-common .

After creating project, you should create the entrypoint file. It is a js/ts file that exports object created with the Profile function.

export const profile = Profile({  
    configSchema,  
  prepare,  
  destroyBench,  
  constructBench,  
  commitTransaction,  
  telemetry: {  
        constructTelemetry,  
        onBenchEnded,  
        onKeyPoint  
  }  
});  

The argument of this function is an object with fields that are functions that get special arguments and return special objects. You can read about them below.

You can find the boilerplate of profile here

configSchema

ConfigSchema is the configuration schema of your profile. The module.config.json file should respect that schema,
otherwise there will be an error. Tank.bench-common uses node-convict
to parse schema, configuration files and commandline arguments.

The configuration from file will be passed to the prepare function.

prepare

This function is called once in the main thread. Here you can make some preparation transactions,
try your connection to the node, create network accounts etc.
Anything you return from this function will be cloned to benchmark threads via the
structured clone algorithm

constructBench

This function is called once for every benchmark thread.
Here you can initialize your connection to the blockchain to commit transactions later.
Anything you return from this function will be passed to the commitTransaction function.
For example, you can return the blockchain connection object

destroyBench

This function is called once for every benchmark thread.
after the last transaction is processed.
Here you can destroy your connection to the blockchain

commitTransaction

This function is called multiple times for every benchmark thread.
Here you may send the transaction to the blockchain network.
You should return the TransactionResult for the prometheus telemetry to run fine
The uniqueData argument contains string that is unique among other threads and this function calls

Telemetry

Tank.bench-common is able to push it's own telemetry to prometheus.
But if you want, you can implement your own telemetry module.

To do this, you should create 3 functions - one will be called when the telemetry
is going to be constructed, one - when destroyed and one will be called every N seconds
(specified via common config).