# Optimizing Web Applications

This page intends to provide some guidance in optimizing web applications. Please refer to the [Web Application optimization pack](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/optimization-packs/web-application-pack) for the list of component types, parameters, metrics, and constraints.

### Telemetry configuration <a href="#telemetry-configuration" id="telemetry-configuration"></a>

No specialized telemetry solution to gather *Web Application* metrics is included. The following providers however can integrate with the provided metrics:

* [CSV File Provider](https://docs.akamas.io/akamas-docs/3.2.1-1/integrating-akamas/integrating-telemetry-providers/csv-provider): this provider can be configured to ingest data points generated by any monitoring application able to export the data in CSV format.
* integrations leveraging [NeoLoad Web](https://docs.akamas.io/akamas-docs/3.2.1-1/integrating-akamas/integrating-telemetry-providers/neoloadweb-provider), [LoadRunner Professional](https://docs.akamas.io/akamas-docs/3.2.1-1/integrating-akamas/integrating-telemetry-providers/loadrunner-professional-provider) or [LoadRunner Enterprise](https://docs.akamas.io/akamas-docs/3.2.1-1/integrating-akamas/integrating-telemetry-providers/loadrunner-enterprise-provider) as a load generator can use this ad-hoc provider that comes out of the box and uses the metrics defined in this optimization pack.

### Workflows <a href="#workflow-design" id="workflow-design"></a>

#### Applying parameters <a href="#applying-parameters" id="applying-parameters"></a>

The provided component type does not define any parameter. The workflow will optimize parameters defined in other component types representing the underlying technological stack.

#### A typical workflow <a href="#a-typical-workflow" id="a-typical-workflow"></a>

A typical workflow to optimize a web application is structured in three parts:

1. **Configure and restart the application**
   1. Use the [FileConfigura operator](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/fileconfigurator-operator) to interpolate the tuned parameters in the configuration files of the underlying stack.
   2. Restart the application using an [Executor operator](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/executor-operator).
   3. Wait for the application to come up using the [Sleep](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/sleep-operator) or [Executor operator](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/executor-operator).
2. **Run the test**
   1. use any of the [available operators](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators) to trigger the execution of the performance test against the application.
3. **Perform the cleanup**
   1. use any of the [available operators](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators) to restore the application to the original state.

Here's an example workflow to perform a test on a Java web application using NeoLoad as a load generator:

{% code lineNumbers="true" %}

```yaml
name: "webapp workflow"
tasks:
  - name: Set Java parameters
    operator: FileConfigurator
    arguments:
      source:
        hostname: myapp.mycompany.com
        username: ubuntu
        key: # ...
        path: /home/ubuntu/conf_template
      target:
        hostname: myapp.mycompany.com
        username: ubuntu
        key: # ...
        path: /home/ubuntu/conf

  - name: Restart application
    operator: Executor
    arguments:
      command: "/home/ubuntu/myapp_down.sh; /home/ubuntu/myapp_sh -opts '/home/ubuntu/conf'"
      host:
        hostname: myapp.mycompany.com
        username: ubuntu
        key: # ...

  - name: Run NeoLoadWeb load test
    operator: NeoLoadWeb
    arguments:
      accountToken: NLW_TOKEN
      projectFile:
        # NeoLoad projectfile location ...
```

{% endcode %}

### Examples

See this [page](https://docs.akamas.io/akamas-docs/3.2.1-1/knowledge-base/optimizing-a-web-application) for an example of a study leveraging the Web Application pack.
