Skip to content

Latest commit

 

History

History
216 lines (97 loc) · 4.53 KB

faastjs.costanalyzer.workload.md

File metadata and controls

216 lines (97 loc) · 4.53 KB
id title hide_title
faastjs.costanalyzer.workload
CostAnalyzer.Workload interface
true

faastjs > CostAnalyzer > Workload

CostAnalyzer.Workload interface

A user-defined cost analyzer workload for CostAnalyzer.analyze().

Example:

Signature:

interface Workload<T extends object, A extends string> 

Properties

Property

Modifiers

Type

Description

concurrency?

number

(Optional) The amount of concurrency to allow. Concurrency can arise from multiple repetitions of the same configuration, or concurrenct executions of different configurations. This concurrency limit throttles the total number of concurrent workload executions across both of these sources of concurrency. Default: 64.

configurations?

Configuration[]

(Optional) An array of configurations to run the work function against (see CostAnalyzer.Configuration). For example, each entry in the array may specify a provider, memory size, and other options. Default: CostAnalyzer.awsConfigurations.

format?

(attr: A, value: number) => string

(Optional) Format an attribute value for console output. This is displayed by the cost analyzer when all of the repetitions for a configuration have completed. The default returns ${attribute}:${value.toFixed(1)}.

formatCSV?

(attr: A, value: number) => string

(Optional) Format an attribute value for CSV. The default returns value.toFixed(1).

funcs

T

The imported module that contains the cloud functions to test.

repetitions?

number

(Optional) The number of repetitions to run the workload for each cost analyzer configuration. Higher repetitions help reduce the jitter in the results. Repetitions execute in the same FaastModule instance. Default: 10.

silent?

boolean

(Optional) If true, do not output live results to the console. Can be useful for running the cost analyzer as part of automated tests. Default: false.

summarize?

(summaries: WorkloadAttribute<A>[]) => WorkloadAttribute<A>

(Optional) Combine CostAnalyzer.WorkloadAttribute instances returned from multiple workload executions (caused by value of CostAnalyzer.Workload.repetitions). The default is a function that takes the average of each attribute.

work

(faastModule: FaastModule<T>) => Promise<WorkloadAttribute<A> | void>

A function that executes cloud functions on faastModule.functions.*. The work function should return void if there are no custom workload attributes. Otherwise, it should return a CostAnalyzer.WorkloadAttribute object which maps user-defined attribute names to numerical values for the workload. For example, this might measure bandwidth or some other metric not tracked by faast.js, but are relevant for evaluating the cost-performance tradeoff of the configurations analyzed by the cost analyzer.