Getting Started with Loadsy
Tags: performance, testing, javascript, tutorial
Published: 2022-02-07 16:40:43

<!-- wp:heading -->
<h2 id="what-is-loadsy">What is Loadsy?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Loadsy [https://www.loadsy.io] is a new kid on the performance testing block. The domain is 800+ days old. First registered on 2019-10-22. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Loadsy is a tool for software developers for performance tests right from the terminal. Writing performance tests from the terminal is not new. Tools like k6, locust have already done this for the past many years.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Loadsy supports writing performance tests in JavaScript on the online IDE as well (from the look and feel, I guess its Monaco editor which powers the VS Code). </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9060,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2022/02/image.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-1024x211.png" alt="Loadsy Online Editor" class="wp-image-9060"/></a><figcaption>Loadsy Online Editor</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 id="features">Features</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Using Loadsy, it is easy to get started with the simple load test. It supports various load profiles such as spike, stress, and more. Loadsy has two flavors: online and CLI. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It gels with the CI/CD automation tools and the reporting user interface is fluid and intuitive. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You can check other features such as reports, and others on their website.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="pricing">Pricing</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The free tier in Loadsy looks peculiar. You can run unlimited tests with 512 threads tops with a duration of 30 seconds for free. The free tier is not a generous offer from Loadsy team. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>$20/month enables 500 hours with unlimited threads/tests/duration. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>$500/month enables 12,500 hours with unlimited threads/tests/duration.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>$1000/month enables 35,500 hours with unlimited threads/tests/duration.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For more than 35,000, you need to contact the sales. </p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="getting-started-with-loadsy">Getting Started with Loadsy</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Head to loadsy.io to sign up for a free account and login. The first step is to organize your tests into projects. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Create a new project by clicking on the <strong>Create Project</strong> button and enter a valid project name, e.g. <code>helloworld</code>. Click on the <code>helloworld</code> project to create scripts and run tests.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9062,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-1.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-1-1024x343.png" alt="Getting Started with Loadsy" class="wp-image-9062"/></a><figcaption>Getting Started with Loadsy</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Click on the Files folder icon which will launch the online IDE. Click on example.ts under the <code>scripts</code> folder to write the tests.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>By default, <code>example.ts</code> will have a placeholder script.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>/* This is a typescript example for loadsy */
const result: ILoadsyResponse = loadsy.get('https://loadsy.io/test', { }, 'Example call to loadsy');
console.log(result.body);

export { };
</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>For the demo purpose, let us add a few more lines to the script. The sleep number is in milliseconds.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>/* This is a typescript example for loadsy */
const result: ILoadsyResponse = loadsy.get('https://loadsy.io/test', { }, 'Example call to loadsy');
console.log(result.body);
console.log(result.status);

loadsy.sleep(3000);

export { };
</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Go to <strong>File &gt; Save file</strong> to save the script.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9063,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-2.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-2.png" alt="Save the script" class="wp-image-9063"/></a><figcaption>Save the script</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 id="run-tests">Run tests</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The next step is to execute the performance test from the UI. Click the <strong>Run test </strong>tab to configure the parameters for the performance test.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>By default, it will autopopulate the values. But if you wish to modify, enter the valid value. In this demo run, it will inject 25 threads w/ 2 requests per second for 30 seconds.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Click on the <strong>Run test </strong>button to start the test.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9064,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-3.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-3.png" alt="Run test" class="wp-image-9064"/></a><figcaption>Run test</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Upon clicking on the Run test button, Loadsy will begin the test and display the stats on the right side as shown below. The below response time is in milliseconds. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9065,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-4.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-4.png" alt="Runtime Stats" class="wp-image-9065"/></a><figcaption>Runtime Stats</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 id="results-analysis">Results Analysis</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Once the test is done, to view the results, click on the <strong>Overview </strong>tab and then navigate to the test.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Loadsy will display the critical stats like threads, start/end time, status, and more on the left side. The <strong>Logs </strong>section displays the <code>console.log</code> messages. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Under the <strong>Calls</strong>, performance stats like response time, RPS, Total Requests and more will be displayed. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9066,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-5.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-5-1024x513.png" alt="Results" class="wp-image-9066"/></a><figcaption>Results</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>By clicking on the <strong>Graph </strong>icon under the calls, opens the graphical representation of the results. Right now, only two graphs are available: <strong>Response time vs Time </strong>and <strong>Request Per Second vs Time</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9067,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-6.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-6.png" alt="Graphs" class="wp-image-9067"/></a><figcaption>Graphs</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 id="loadsy-cli">Loadsy CLI</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Most of the developers and system admins hate the user interface. Enter loadsy CLI. Loadsy CLI is available as a npm package.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The only prerequisite is to have Node.js installed. Node.js is a JavaScript runtime environment to run JavaScript where npm is a package manager.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Head to https://nodejs.org/en/download/ to install Node.js and npm.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below is my node and npm version.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9068,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-7.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-7.png" alt="Validate Node and NPM" class="wp-image-9068"/></a><figcaption>Validate Node and NPM</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>To install loadsy, enter <code>npm install -g @loadsy/cli</code></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To validate the installation, enter <code>loadsy -V</code>. The current version is 2.0.7.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To view the help, enter <code>loadsy -h</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The first step is to login into your Loadsy account in the CLI. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Enter the below command to login. I have stored my Loadsy password in the variable on PowerShell.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><code>loadsy login -e &lt;email_id&gt; -p $loadsy_password</code></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9069,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-8.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-8.png" alt="Loadsy Login" class="wp-image-9069"/></a><figcaption>Loadsy Login</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The second step is to create a project. Enter the below command to create a project called <code>MyPerf-Project</code>. This will create a typescript project in your current directory.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><code>loadsy create MyPerf-Project --typescript</code></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="writing-tests">Writing Tests</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The next step is to write performance tests in your favorite editor. I recommend VS Code. Open <code>scripts\example.ts</code> file and paste the below code. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below block sends two requests: one is GET to loadsy.io/test and another one is POST to reqres.in to create a user.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>/* This is a typescript example for loadsy */
const result: ILoadsyResponse = loadsy.get('https://loadsy.io/test', { "accept":"*/*" }, 'T00_Loadsy');
console.log(result.status);

loadsy.sleep(1000);

const createUser: ILoadsyResponse = loadsy.post('https://reqres.in/api/users',{"Content-Type": "application/json" },{name:"morpheus",job:"leader"}, 'T10_CreateUser');
console.log(createUser.status);
console.log(createUser.body);

loadsy.sleep(1000);

export { };</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Save the script.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The next step is to compile the script using <code>loadsy build</code> command which creates a JavaScript file under <code>.build</code> folder. Once the compiling is successful, it is time to upload the project to Loadsy dashboard.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Enter <code>loadsy upload</code> which uploads the scripts to your account. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To start the test, enter <code>loadsy run example.ts</code> which will start the test.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9070,"sizeSlug":"full","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-9.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-9.png" alt="Loadsy Run" class="wp-image-9070"/></a><figcaption>Loadsy Run</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>To view the details stats, login into your Loadsy dashboard, navigate to the project, then click on the tests.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Under the Calls section, you can see the below records.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":9071,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2022/02/image-10.png"><img src="https://qainsights.com/wp-content/uploads/2022/02/image-10-1024x197.png" alt="Loadsy Calls" class="wp-image-9071"/></a><figcaption>Loadsy Calls</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 id="conclusion">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Loadsy certainly fulfills the basic needs of performance testing. The support for CLI and the web interface, profiles, developer-friendly, CI/CD integration, CSV support, managing the users, billing, and more are the selling points of Loadsy. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>But under the hood, how it works, its infrastructure, distributing the load, integrations with APM and Observability tools, on-premise deployment, recording, multiple protocols, cloud integrations, and more are still a question mark.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>As a performance engineer, you should definitely try Loadsy for once.</p>
<!-- /wp:paragraph -->