autotuner 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a0cbc0a71a4fe3322d56efe07228bc9e9f7abc0e63f5d6449d86bcc8d7e4475
4
- data.tar.gz: a07a9184f3615a5e4da4a7d66ffae945e5da377e8cb089a0fcd1b40735c3d093
3
+ metadata.gz: 511df4fa38774e70c89c66a4d3692098537189c2281851896327ce7b7df6fc05
4
+ data.tar.gz: b97736b7e50e47753c0f487a37e32fd7fc3d3869ab50e6197cea4894978f7208
5
5
  SHA512:
6
- metadata.gz: de54a820d1e5674b1a0b14d2519a2bd89e28f0d7d11690cf90e83a1ace67c829a2c9f019d4487952a4d2432146a857dce6905e82513273267ba7835beff2fcaa
7
- data.tar.gz: fd56fb285f351006ac7091c24db412a96518d82771beebcbcbd16107d41e0a2a4af382b5ce2a3a719a21fb96aeea20bbd421e429eba568b3cd1d34a39ab58048
6
+ metadata.gz: 2bebcb6ee78c76d67b11436a4466629094e8157820a330fbcb93286d82a725b688cc0aad4ee9dd264a929a5669a30f9a8ab90f27a89a4b85885f9437a6b28070
7
+ data.tar.gz: 5e69496888210a882723e2d9d54af4daf35546c7ddf14a5c225c07e51aedcf331e8d90d998a6eba267d6d8abcfb9474bd54dbbbee76cd2828dcef6f2a429e35f
data/.rubocop.yml CHANGED
@@ -6,7 +6,6 @@ require: rubocop-minitest
6
6
  AllCops:
7
7
  NewCops: enable
8
8
  SuggestExtensions: false
9
- TargetRubyVersion: 2.6
10
9
 
11
10
  Minitest/AssertInDelta:
12
11
  Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ autotuner (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ json (2.7.1)
11
+ language_server-protocol (3.17.0.3)
12
+ minitest (5.22.3)
13
+ mocha (2.1.0)
14
+ ruby2_keywords (>= 0.0.5)
15
+ parallel (1.24.0)
16
+ parser (3.3.0.5)
17
+ ast (~> 2.4.1)
18
+ racc
19
+ racc (1.7.3)
20
+ rainbow (3.1.1)
21
+ rake (13.1.0)
22
+ regexp_parser (2.9.0)
23
+ rexml (3.2.6)
24
+ rubocop (1.62.1)
25
+ json (~> 2.3)
26
+ language_server-protocol (>= 3.17.0)
27
+ parallel (~> 1.10)
28
+ parser (>= 3.3.0.2)
29
+ rainbow (>= 2.2.2, < 4.0)
30
+ regexp_parser (>= 1.8, < 3.0)
31
+ rexml (>= 3.2.5, < 4.0)
32
+ rubocop-ast (>= 1.31.1, < 2.0)
33
+ ruby-progressbar (~> 1.7)
34
+ unicode-display_width (>= 2.4.0, < 3.0)
35
+ rubocop-ast (1.31.2)
36
+ parser (>= 3.3.0.4)
37
+ rubocop-minitest (0.35.0)
38
+ rubocop (>= 1.61, < 2.0)
39
+ rubocop-ast (>= 1.31.1, < 2.0)
40
+ rubocop-shopify (2.15.1)
41
+ rubocop (~> 1.51)
42
+ ruby-progressbar (1.13.0)
43
+ ruby2_keywords (0.0.5)
44
+ unicode-display_width (2.5.0)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ autotuner!
51
+ minitest (~> 5.0)
52
+ mocha
53
+ rake (~> 13.0)
54
+ rubocop (~> 1.21)
55
+ rubocop-minitest
56
+ rubocop-shopify
57
+
58
+ BUNDLED WITH
59
+ 2.4.10
data/README.md CHANGED
@@ -32,6 +32,9 @@ $ bundle add autotuner
32
32
  # This (optional) callback is called to provide metrics that can give you
33
33
  # insights about the performance of your app. It's recommended to send this
34
34
  # data to your observability service (e.g. Datadog, Prometheus, New Relic, etc).
35
+ # Use a metric type that would allow you to calculate the average and percentiles.
36
+ # On Datadog this would be the distribution type. On Prometheus this would be
37
+ # the histogram type.
35
38
  Autotuner.metrics_reporter = proc do |metrics|
36
39
  # stats is a hash of metric name (string) to integer value.
37
40
  metrics.each do |key, val|
@@ -61,7 +64,7 @@ While autotuner aims to comprehensively analyze your traffic to give the suggest
61
64
  ## Configuration
62
65
 
63
66
  - `Autotuner.enabled=`: (required, unless `Autotuner.sample_ratio` is set) Sets whether autotuner is enabled or not. When autotuner is disabled, data is not collected and suggestions are not given. Defaults to `false`.
64
- - `Autotuner.sample_ratio=`: (optional) Sets the portion of instances where autotuner is enabled. Pass a value between 0 (enabled on no intances) and 1.0 (enabled on all instances). Note that this does not sample reqeusts, but rather samples the portion of instances that have autotuner enabled (it will be enabled for all requests on those instances). Do not configure `Autotuner.enabled=` when you use this option.
67
+ - `Autotuner.sample_ratio=`: (optional) Sets the portion of instances where autotuner is enabled. Pass a value between 0 (enabled on no intances) and 1.0 (enabled on all instances). Note that this does not sample requests, but rather samples the portion of instances that have autotuner enabled (it will be enabled for all requests on those instances). Do not configure `Autotuner.enabled=` when you use this option.
65
68
  - `Autotuner.reporter=`: (required) Callback called when a heuristic is ready to give a suggestion. The callback will be called with one argument which will be an instance of `Autotuner::Report::Base`. Call `#to_s` on this object to get a string containing instructions and recommendations. You must set this when autotuner is enabled.
66
69
  - `Autotuner.debug_reporter=`: (optional) Callback to periodically emit debug messages of internal state of heuristics. The callback will be called with one argument which will be a hash with the heuristic name as the key and the debug message as the value. Regular users do not need to configure this as this is only useful for debugging purposes.
67
70
  - `Autotuner.metrics_reporter=`: (optional) Callback to emit useful metrics about your service. The callback will be called with a hash containing the metric names (string) as the key and integer values.
@@ -43,9 +43,13 @@ module Autotuner
43
43
 
44
44
  For example, in Puma, add the following code into config/puma.rb:
45
45
 
46
+ compacted = false
46
47
  before_fork do
47
- 3.times { GC.start }
48
- GC.compact
48
+ unless compacted
49
+ 3.times { GC.start }
50
+ GC.compact
51
+ compacted = true
52
+ end
49
53
  end
50
54
  MSG
51
55
  end
@@ -28,7 +28,7 @@ module Autotuner
28
28
  HEAP_SIZE_CONFIGURATION_DELTA = 1_000
29
29
 
30
30
  REPORT_ASSIST_MESSAGE = <<~MSG
31
- The following suggestions adjusts the size of heap at boot time, which can improve bootup speed and reduce the time taken for the app to reach peak performance.
31
+ The following suggestions adjust the size of the heap at boot time, which can improve bootup speed and reduce the time taken for the app to reach peak performance.
32
32
  MSG
33
33
 
34
34
  def initialize(_system_context)
@@ -68,9 +68,9 @@ module Autotuner
68
68
 
69
69
  Report::MultipleEnvironmentVariables.new(
70
70
  <<~MSG,
71
- The following suggestions reduces the number of minor garbage collection cycles, specifically a cycle called "malloc". Your app runs malloc cycles in approximately #{format("%.2f", malloc_gc_ratio * 100)}% of all minor garbage collection cycles.
71
+ The following suggestions reduce the number of minor garbage collection cycles, specifically a cycle called "malloc". Your app runs malloc cycles in approximately #{format("%.2f", malloc_gc_ratio * 100)}% of all minor garbage collection cycles.
72
72
 
73
- Reducing minor garbage collection cycles can help reduce response times. The following tuning values aims to reduce malloc garbage collection cycles by setting it to a higher value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
73
+ Reducing minor garbage collection cycles can help reduce response times. The following tuning values aim to reduce malloc garbage collection cycles by setting it to a higher value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
74
74
  MSG
75
75
  [LIMIT_ENV, LIMIT_MAX_ENV],
76
76
  # Suggest to double the limit and max
@@ -67,9 +67,9 @@ module Autotuner
67
67
 
68
68
  Report::MultipleEnvironmentVariables.new(
69
69
  <<~MSG,
70
- The following suggestions reduces the number of major garbage collection cycles, specifically a cycle called "oldmalloc". Your app runs oldmalloc cycles in approximately #{format("%.2f", oldmalloc_gc_ratio * 100)}% of all major garbage collection cycles.
70
+ The following suggestions reduce the number of major garbage collection cycles, specifically a cycle called "oldmalloc". Your app runs oldmalloc cycles in approximately #{format("%.2f", oldmalloc_gc_ratio * 100)}% of all major garbage collection cycles.
71
71
 
72
- Reducing major garbage collection cycles can help reduce response times, especially for the extremes (e.g. p95 or p99 response times). The following tuning values aims to disable oldmalloc garbage collection cycles by setting it to an extremely high value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
72
+ Reducing major garbage collection cycles can help reduce response times, especially for the extremes (e.g. p95 or p99 response times). The following tuning values aim to disable oldmalloc garbage collection cycles by setting it to an extremely high value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
73
73
  MSG
74
74
  [LIMIT_ENV, LIMIT_MAX_ENV],
75
75
  [LIMIT_ENV_SUGGESTED_VALUE, LIMIT_MAX_SUGGESTED_VALUE],
@@ -65,9 +65,9 @@ module Autotuner
65
65
 
66
66
  Report::SingleEnvironmentVariable.new(
67
67
  <<~MSG,
68
- The following suggestions reduces the number of major garbage collection cycles, specifically a cycle called "remembered write barrier unprotected" (also know as "shady" due to historical reasons). Your app runs remembered write barrier unprotected cycles in approximately #{format("%.2f", wb_unprotected_gc_ratio * 100)}% of all major garbage collection cycles.
68
+ The following suggestions reduce the number of major garbage collection cycles, specifically a cycle called "remembered write barrier unprotected" (also know as "shady" due to historical reasons). Your app runs remembered write barrier unprotected cycles in approximately #{format("%.2f", wb_unprotected_gc_ratio * 100)}% of all major garbage collection cycles.
69
69
 
70
- Reducing major garbage collection cycles can help reduce response times, especially for the extremes (e.g. p95 or p99 response times). The following tuning values aims to disable oldmalloc garbage collection cycles by setting it to an extremely high value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
70
+ Reducing major garbage collection cycles can help reduce response times, especially for the extremes (e.g. p95 or p99 response times). The following tuning values aim to disable oldmalloc garbage collection cycles by setting it to an extremely high value. This may cause a slight increase in memory usage. You should monitor memory usage carefully to ensure your app is not running out of memory.
71
71
  MSG
72
72
  LIMIT_RATIO_ENV,
73
73
  suggested_limit_ratio,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Autotuner
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotuner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zhu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-28 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mocha
@@ -60,7 +60,9 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".rubocop.yml"
63
+ - ".ruby-version"
63
64
  - Gemfile
65
+ - Gemfile.lock
64
66
  - LICENSE.txt
65
67
  - README.md
66
68
  - Rakefile
@@ -98,14 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
100
  requirements:
99
101
  - - ">="
100
102
  - !ruby/object:Gem::Version
101
- version: 2.6.0
103
+ version: 3.1.0
102
104
  required_rubygems_version: !ruby/object:Gem::Requirement
103
105
  requirements:
104
106
  - - ">="
105
107
  - !ruby/object:Gem::Version
106
108
  version: '0'
107
109
  requirements: []
108
- rubygems_version: 3.4.10
110
+ rubygems_version: 3.5.3
109
111
  signing_key:
110
112
  specification_version: 4
111
113
  summary: Get suggestions to tune Ruby's garbage collector