# CAP as a web application stress test tool

Keywords:

Stress test, stand-alone agent, rule wizard, performance

The context:

A company has developed a new web application that works really well on the local network, but customers are complaining that the performance over the internet from a smartphone is unbearable. However, testing against a live system was also problematic, yet the test system was not on the internet.

The solution:

Using the CAP forwarding proxy and New Rules Wizard, a simple run-through of the application was performed and recorded. This was used to perform a stress test and the problem area was quickly identified and fixed.

Deployment diagram:

<figure><img src="/files/iKiEuPGjbgcgqxcslwCW" alt=""><figcaption></figcaption></figure>

Why CAP:

CAP is capable of interacting with a vast array of data sources, protocols and APIs out of the box. It also has a stress testing framework to facilitate the load of many users, including randomization of data, ramp up times and hot-spot reporting.

The story:

Complaints from users that your site is very slow from mobile devices is never pleasant. But it gets more unnerving when you can’t replicate the problem. In this present scenario, the culprit was not so much the site itself as the bandwidth that it consumed.

However, getting visibility of what is consuming bandwidth can be tricky and even then, most developers are focussed on download data (images, Javascript and so on), rather than what the user might be sending.

So a simple record of a mobile interaction was performed on the local network and with some simple tweaks to randomize user names put in place, 50 concurrent users where directed at the test site to determine where a bottle neck may exist.

Normally, small bandwidth issues on a LAN will be hard to spot, but using the CAP performance hot-spot diagrams, the culprit was quickly found. It focussed on a single POST operation that took just a few more milliseconds that it should. Upon further investigation, it turned out that posting 600KB of terms and conditions in a read-only text area field every time an order is placed is a bad idea – and a quick HTML change solved the issue and restored performance to levels that users expected.

Rules blocks and components used:

Stress Testing Rules

New Rules Wizard


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tomorrowx.com/cap/guides/examples/cap-as-a-web-application-stress-test-tool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
