Skip to content

Commit dadf479

Browse files
authored
[ruby/grape] Reduce connection pool size (#8568)
I got the following results locally: ``` +--------+---------+------+-----+-----+-----+-------+--------------+ |threads |plaintext|update| json| db|query|fortune|weighted_score| +--------+---------+------+-----+-----+-----+-------+--------------+ |master | 30018| 5669|51864|20665|10083| | 699| |5 | 19278| 7043|50914|23169|11094| | 817| |3 | 21420| 7287|46779|23205|10921| | 826| |2 | 22695| 7981|48680|24954|11535| | 892| +--------+---------+------+-----+-----+-----+-------+--------------+ ```
1 parent a044f42 commit dadf479

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

frameworks/Ruby/grape/config.ru

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'erb'
22
require 'active_record'
33
require 'yaml'
4+
require_relative 'config/auto_tune'
45

56
MAX_PK = 10_000
67
QUERIES_MIN = 1

frameworks/Ruby/grape/config/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ production:
55
database: hello_world
66
username: benchmarkdbuser
77
password: benchmarkdbpass
8-
pool: 512
8+
pool: 2
99
timeout: 5000

frameworks/Ruby/grape/config/puma.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
num_workers, num_threads = auto_tune
55

66
workers num_workers
7-
threads num_threads, num_threads
7+
8+
threads 2, 2
9+
810
# Use the `preload_app!` method when specifying a `workers` number.
911
# This directive tells Puma to first boot the application and load code
1012
# before forking the application. This takes advantage of Copy On Write

0 commit comments

Comments
 (0)