Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cf0a1f60
Commit
cf0a1f60
authored
Jan 03, 2020
by
Matthias Kaeppler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Runtime.max_threads to size Redis caches
parent
cc77644b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
lib/gitlab/redis/wrapper.rb
lib/gitlab/redis/wrapper.rb
+2
-5
spec/support/redis/redis_shared_examples.rb
spec/support/redis/redis_shared_examples.rb
+5
-5
No files found.
lib/gitlab/redis/wrapper.rb
View file @
cf0a1f60
...
@@ -22,11 +22,8 @@ module Gitlab
...
@@ -22,11 +22,8 @@ module Gitlab
def
pool_size
def
pool_size
# heuristic constant 5 should be a config setting somewhere -- related to CPU count?
# heuristic constant 5 should be a config setting somewhere -- related to CPU count?
size
=
5
size
=
5
if
Gitlab
::
Runtime
.
sidekiq?
if
Gitlab
::
Runtime
.
multi_threaded?
# the pool will be used in a multi-threaded context
size
+=
Gitlab
::
Runtime
.
max_threads
size
+=
Sidekiq
.
options
[
:concurrency
]
elsif
Gitlab
::
Runtime
.
puma?
size
+=
Puma
.
cli_config
.
options
[
:max_threads
]
end
end
size
size
...
...
spec/support/redis/redis_shared_examples.rb
View file @
cf0a1f60
...
@@ -116,9 +116,9 @@ RSpec.shared_examples "redis_shared_examples" do
...
@@ -116,9 +116,9 @@ RSpec.shared_examples "redis_shared_examples" do
clear_pool
clear_pool
end
end
context
'when running
not on sidekiq workers
'
do
context
'when running
on single-threaded runtime
'
do
before
do
before
do
allow
(
Gitlab
::
Runtime
).
to
receive
(
:
sidekiq
?
).
and_return
(
false
)
allow
(
Gitlab
::
Runtime
).
to
receive
(
:
multi_threaded
?
).
and_return
(
false
)
end
end
it
'instantiates a connection pool with size 5'
do
it
'instantiates a connection pool with size 5'
do
...
@@ -128,10 +128,10 @@ RSpec.shared_examples "redis_shared_examples" do
...
@@ -128,10 +128,10 @@ RSpec.shared_examples "redis_shared_examples" do
end
end
end
end
context
'when running on
sidekiq workers
'
do
context
'when running on
multi-threaded runtime
'
do
before
do
before
do
allow
(
Gitlab
::
Runtime
).
to
receive
(
:
sidekiq
?
).
and_return
(
true
)
allow
(
Gitlab
::
Runtime
).
to
receive
(
:
multi_threaded
?
).
and_return
(
true
)
allow
(
Sidekiq
).
to
receive
(
:options
).
and_return
({
concurrency:
18
}
)
allow
(
Gitlab
::
Runtime
).
to
receive
(
:max_threads
).
and_return
(
18
)
end
end
it
'instantiates a connection pool with a size based on the concurrency of the worker'
do
it
'instantiates a connection pool with a size based on the concurrency of the worker'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment