Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the "query_stats" option and disable it #495

Merged
merged 2 commits into from
Aug 5, 2019
Merged

Conversation

kyrylo
Copy link
Contributor

@kyrylo kyrylo commented Aug 5, 2019

Likely fixes:

The SQL query collection feature is still in alpha and we display it only for
certain accounts. Therefore, the vast majority of our customers cannot even see
what airbrake-ruby collects. Since the feature is still in alpha, it is
currently buggy (in a sense that it consumes too much memory & CPU power).

I profiled a Rails app on a certain route with memory_profiler for Rack Mini
Profiler and I can see a significant increase of memory usage.

=== performance_stats = false

Total allocated: 12434583 bytes (145711 objects)
Total retained:  508023 bytes (3346 objects)

allocated memory by gem

       264  airbrake/lib

=== performance_stats = true && query_stats = false

Total allocated: 12461685 bytes (146002 objects)
Total retained:  508431 bytes (3353 objects)

allocated memory by gem

      3816  airbrake/lib

=== performance_stats = true && query_stats = true

Total allocated: 186535107 bytes (1447037 objects)
Total retained:  35810972 bytes (349882 objects)

allocated memory by gem

    709720  airbrake/lib

According to these reports memory usage ramped up by 700% compared to the route
stats feature. The route stats feature itself is already quite expensive and the
query collection feature is just too much.

kyrylo added 2 commits August 5, 2019 21:23
Likely fixes:

* airbrake/airbrake#994 (Memory usage)
* airbrake/airbrake#990 (CPU and Average Response
  increased after version 7)

The SQL query collection feature is still in alpha and we display it only for
certain accounts. Therefore, the vast majority of our customers cannot even see
what airbrake-ruby collects. Since the feature is still in alpha, it is
currently buggy (in a sense that it consumes too much memory & CPU power).

I profiled a Rails app on a certain route with `memory_profiler` for Rack Mini
Profiler and I can see a significant increase of memory usage.

=== performance_stats = false

```
Total allocated: 12434583 bytes (145711 objects)
Total retained:  508023 bytes (3346 objects)

allocated memory by gem

       264  airbrake/lib
```

=== performance_stats = true && query_stats = false

```
Total allocated: 12461685 bytes (146002 objects)
Total retained:  508431 bytes (3353 objects)

allocated memory by gem

      3816  airbrake/lib
```

=== performance_stats = true && query_stats = true

```
Total allocated: 186535107 bytes (1447037 objects)
Total retained:  35810972 bytes (349882 objects)

allocated memory by gem

    709720  airbrake/lib
```

According to these reports memory usage ramped up by 700% compared to the route
stats feature. The route stats feature itself is already quite expensive and the
query collection feature is just too much.
@kyrylo kyrylo force-pushed the query-stats-option branch from 9a71155 to dd106cd Compare August 5, 2019 13:30
@kyrylo kyrylo merged commit 58c0996 into master Aug 5, 2019
@kyrylo kyrylo deleted the query-stats-option branch August 5, 2019 13:34
kyrylo added a commit to airbrake/airbrake that referenced this pull request Aug 5, 2019
Likely fixes:

* #994 (Memory usage)
* #990 (Add support for Rails engine route prefixes)

More details in airbrake/airbrake-ruby#495. In short,
this disables SQL query collection by default and allows enabling it only for
certain accounts.
kyrylo added a commit to airbrake/airbrake that referenced this pull request Aug 5, 2019
Likely fixes:

* #994 (Memory usage)
* #990 (Add support for Rails engine route prefixes)

More details in airbrake/airbrake-ruby#495. In short,
this disables SQL query collection by default and allows enabling it only for
certain accounts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant