> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# neocortix/loadtest

Perform Neocortix Last-Mile Load Testing for your projects, using our global network of mobile devices.

Get an Auth Token by following these steps:
- Go to cloud.neocortix.com
- Sign up for a Neocortix Cloud Services account with your email address.
    - You will be able to run one small, free Load Test in the Free Tier (with 2 devices, up to 10 minutes long) without providing any payment method.  Or you can run two small free Load Tests with one device each.
    - To continue with free Load Tests in the Free Tier (up to 10 devices, up to 10 minutes long), please provide a Payment Method at Account / Billing / Payment Methods, which will not be charged while you use your 100 free hours.
    - To run Large Load Tests (up to 800 devices, any duration), please provide a Payment Method as above, and then go to Account / Billing and upgrade from Free Tier to Paid Tier.
- Go to Account / Profile.  Click on Auth Tokens.
- Click on New Token.  A new Auth Token will be generated for you.  You can copy that Auth Token to the clipboard and use it as the value of $NCS_AUTH_TOKEN in the steps below.


## Commands

### loadtest

performs a loadtest using Necocortix Last-Mile Loadtest service (in the current container)


| Parameter | Type | Default | Description |
|---|---|---|---|
| `altTargetHostUrl` | string | "" | an alternative target host URL for comparison |
| `branch` | string | master | which branch to get orb support code from |
| `nWorkers` | integer | 1 | the # of worker instances to launch (or zero for all available) |
| `ncs_auth_token` | env_var_name | NCS_AUTH_TOKEN | (advanced) the name of the env var to use for NCS_AUTH_TOKEN) |
| `rampUpRate` | string | 0 | # of simulated users to start per second (overall) (floating point number) |
| `regions` | string |  | list of geographic regions (space-separated) (or empty for all regions) |
| `reqMsprMean` | integer | 1000 | Pass/Fail threshold for Mean Response Time (in milliseconds).   The Mean Response Time is calculated in the last 30-second window of the test.  If the Mean Response Time in the last 30-second window is less than the threshold, the test Passes; otherwise it fails. |
| `susTime` | integer | 15 | how much time to sustain the test after startup (in seconds) |
| `targetHostUrl` | string |  | url of the host to target as victim |
| `targetUris` | string |  | list of URIs to target (space-separated) or empty for root |
| `usersPerWorker` | integer | 6 | # of simulated users per worker |

## Jobs

### loadtest

performs a loadtest using Necocortix Last-Mile Loadtest service (in a dedicated container)


| Parameter | Type | Default | Description |
|---|---|---|---|
| `altTargetHostUrl` | string | "" | an alternative target host URL for comparison |
| `branch` | string | master | which branch to get get orb support code from |
| `executorImage` | string | circleci/python:3.6 | (advanced) use this only if you need to override the python executor |
| `nWorkers` | integer | 1 | the # of worker instances to launch (or zero for all available) |
| `ncs_auth_token` | env_var_name | NCS_AUTH_TOKEN | (advanced) the name of the env var to use for NCS_AUTH_TOKEN) |
| `rampUpRate` | string | 0 | # of simulated users to start per second (overall) (floating point number) |
| `regions` | string |  | list of geographic regions (space-separated) (or empty for all regions) |
| `reqMsprMean` | integer | 1000 | Pass/Fail threshold for Mean Response Time (in milliseconds).   The Mean Response Time is calculated in the last 30-second window of the test.  If the Mean Response Time in the last 30-second window is less than the threshold, the test Passes; otherwise it fails. |
| `susTime` | integer | 15 | how much time to sustain the test after startup (in seconds) |
| `targetHostUrl` | string |  | url of the host to target as victim |
| `targetUris` | string |  | list of URIs to target (space-separated) or empty for root |
| `usersPerWorker` | integer | 6 | # of simulated users per worker |

## Executors

### default

uses a generic python 3 image, unless the caller overrides


| Parameter | Type | Default | Description |
|---|---|---|---|
| `image` | string | circleci/python:3.6 | (advanced) override the default to use a different docker image |

## Examples

### loadtest_only

This simple python-oriented example does a small loadtest using a command based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.


```yaml
jobs:
  build:
    docker:
      - image: circleci/python:3.6
    steps:
      - loadtest/loadtest:
          nWorkers: 2
          susTime: 30
          targetHostUrl: https://www.example.com
version: 2.1
```

### loadtest_workflow

This mainstream example does a small loadtest using a workflow with a job based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.


```yaml
jobs:
  build:
    docker:
      - image: circleci/node:10
    steps:
      - checkout
      - run: echo your BUILD code here
version: 2.1
workflows:
  build_and_test:
    jobs:
      - build
      - loadtest/loadtest:
          nWorkers: 2
          requires:
            - build
          susTime: 30
          targetHostUrl: https://www.example.com
  version: 2
```