<!-- Source: https://docs.squirro.com/en/latest/technical/admin/troubleshooting/performance-investigation.html -->
# Investigating Performance Issues

## Frontend Performance Tracing

There are two possible ways to record performance logging for the frontend:

- Offline: where the values are stored in a CSV file.
- Online: using New Relic.

This frontend performance logging can be enabled by setting `frontend.performance` option to true, in the configuration service.

To enable online performance logging (using New Relic), please set the `frontend.new_relic` option to true.

In case the `frontend.performance` option is set to true and `frontend.new_relic` is set to false, then offline logging will take place.

For information on how to update configuration options, see [Configuration](../configuration/index.md#admin-config).

## Finding the Most Time Consuming Component in a Request

If a Squirro request is slow (e.g when querying a result), you can investigate which component is using excessive time by using parameter `&timing=true` in the request to see a detailed time report of the request.

To investigate a Squirro request, from your browser, open the menu **Tools > Web Developer > Network** (Firefox) or **View > Developer > Developer** Tools (Chrome), and submit the query again. You should see the request in the developer tool:

[![image1](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/153780340/262176852.png)](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/153780340/262176852.png)

copy this request, add `&timing=true&token={your_squirro_token}`, and enter it into the address bar of your browser to get the response.

The timing report should look like the example code below.

_Note:_ `time_took_ms` is the execution of each component and `time_ms` is the total execution time. If you suspect the Elasticsearch request is slow, look at the node `Elasticsearch\/squirro...` in the response to see how long it took.

```json
{
  "timing_report": {
    "wrapped_f": {
      "start_time": 1518611439.118776083,
      "_validate_request_params": {
        "time_took_ms": 0,
        "start_time": 1518611439.1258709431
      },
      "time_took_ms": 36,
      "_run_query_with": {
        "time_took_ms": 20,
        "read_items_by": {
          "time_took_ms": 18,
          "_do_read_items_by": {
            "_read_items_by_query": {
              "time_took_ms": 11,
              "start_time": 1518611439.141078949,
              "_execute_query": {
                "Elasticsearch/squirro_v8_3pwqmqilsz-t3w3u6xts1q/item/_search": {
                  "time_took_ms": 8,
                  "start_time": 1518611439.1428649426
                },
                "time_took_ms": 10,
                "start_time": 1518611439.1418509483,
                "_cache_if_result_not_empty_on_timeout": {
                  "time_took_ms": 0,
                  "start_time": 1518611439.1512749195
                }
              }
            }
          },
          "start_time": 1518611439.1355009079,
          "_validate_params": {
            "time_took_ms": 0,
            "start_time": 1518611439.1356248856
          }
        }
      },
      "_get_query_params": {
        "time_took_ms": 7,
        "_expand_all_aggregations": {
          "time_took_ms": 0,
          "start_time": 1518611439.1336150169
        },
        "start_time": 1518611439.1260149479
      }
    }
  },
  "time_ms": 40,
  "total": 7
}
```
