Skip to content

Commit

Permalink
[ruby/grape] Reduce connection pool size (TechEmpower#8568)
Browse files Browse the repository at this point in the history
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|
+--------+---------+------+-----+-----+-----+-------+--------------+
```
  • Loading branch information
p8 authored Jan 3, 2024
1 parent a044f42 commit dadf479
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions frameworks/Ruby/grape/config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'erb'
require 'active_record'
require 'yaml'
require_relative 'config/auto_tune'

MAX_PK = 10_000
QUERIES_MIN = 1
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Ruby/grape/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ production:
database: hello_world
username: benchmarkdbuser
password: benchmarkdbpass
pool: 512
pool: 2
timeout: 5000
4 changes: 3 additions & 1 deletion frameworks/Ruby/grape/config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
num_workers, num_threads = auto_tune

workers num_workers
threads num_threads, num_threads

threads 2, 2

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
Expand Down

0 comments on commit dadf479

Please sign in to comment.