Skip to content

orijtech/cosmosloadtester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cosmosloadtester

cosmosloadtester is a load-testing tool built on top of informalsystems/tm-load-test. It uses an enhanced fork of tm-load-test, which provides significantly more-detailed stats such as latency percentile breakdowns and detailed graphs of QPS over time.

The tool consists of a Go server which exposes the loadtest service over HTTP using gRPC-web and a built-in React UI for scheduling loadtests and visualizing results. The gRPC service can also be interacted with without the UI by using gRPC, gRPC-Gateway, or gRPC-web.

To leverage this tool, you'll need to write logic to generate transactions for your message type.

Building and running the server

  1. Build the UI:
make ui
  1. Build the server:
make server
  1. Run the server:
./bin/server --port=8080
  1. The server should be available at http://localhost:8080

Registering custom client factories

To use this tool, you will need to write a client factory that generates transactions for the message type(s) you want to load-test.

  1. Create your custom client factory.

    For use as a template, a sample client factory that generates an empty Cosmos transaction can be found under clients/myabciapp/client.go:

    // GenerateTx must return the raw bytes that make up the transaction for your
    // ABCI app. The conversion to base64 will automatically be handled by the
    // loadtest package, so don't worry about that. Only return an error here if you
    // want to completely fail the entire load test operation.
    func (c *CosmosClient) GenerateTx() ([]byte, error) {
    txBuilder := c.txConfig.NewTxBuilder()
    // TODO: add messages to this transaction.
    return c.txConfig.TxEncoder()(txBuilder.GetTx())
    }

  2. Register your factory with a meaningful name in registerClientFactories in cmd/server/main.go:

    // Add logic to register your custom client factories to this function.
    func registerClientFactories() error {
    cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
    txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes)
    cosmosClientFactory := myabciapp.NewCosmosClientFactory(txConfig)
    if err := loadtest.RegisterClientFactory("test-cosmos-client-factory", cosmosClientFactory); err != nil {
    return fmt.Errorf("failed to register client factory %s: %w", "test-cosmos-client-factory", err)
    }
    return nil
    }

  3. After adding and registering your client factory, make sure to rebuild the server.

  4. Then, you can enter its name under Client factory in the UI to use it:

    image

Images

Input screen

Results

Sequence diagram

image