Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0aca977c
Commit
0aca977c
authored
Jul 18, 2018
by
antirez
Browse files
Merge branch 'unstable' of github.com:/antirez/redis into unstable
parents
313b2240
22e9321c
Changes
2
Show whitespace changes
Inline
Side-by-side
src/defrag.c
View file @
0aca977c
...
@@ -867,9 +867,8 @@ void defragDictBucketCallback(void *privdata, dictEntry **bucketref) {
...
@@ -867,9 +867,8 @@ void defragDictBucketCallback(void *privdata, dictEntry **bucketref) {
* or not, a false detection can cause the defragmenter to waste a lot of CPU
* or not, a false detection can cause the defragmenter to waste a lot of CPU
* without the possibility of getting any results. */
* without the possibility of getting any results. */
float
getAllocatorFragmentation
(
size_t
*
out_frag_bytes
)
{
float
getAllocatorFragmentation
(
size_t
*
out_frag_bytes
)
{
size_t
resident
=
server
.
cron_malloc_stats
.
allocator_resident
;
size_t
resident
,
active
,
allocated
;
size_t
active
=
server
.
cron_malloc_stats
.
allocator_active
;
zmalloc_get_allocator_info
(
&
allocated
,
&
active
,
&
resident
);
size_t
allocated
=
server
.
cron_malloc_stats
.
allocator_allocated
;
float
frag_pct
=
((
float
)
active
/
allocated
)
*
100
-
100
;
float
frag_pct
=
((
float
)
active
/
allocated
)
*
100
-
100
;
size_t
frag_bytes
=
active
-
allocated
;
size_t
frag_bytes
=
active
-
allocated
;
float
rss_pct
=
((
float
)
resident
/
allocated
)
*
100
-
100
;
float
rss_pct
=
((
float
)
resident
/
allocated
)
*
100
-
100
;
...
...
tests/unit/memefficiency.tcl
View file @
0aca977c
...
@@ -41,7 +41,7 @@ start_server {tags {"defrag"}} {
...
@@ -41,7 +41,7 @@ start_server {tags {"defrag"}} {
test
"Active defrag"
{
test
"Active defrag"
{
r config set activedefrag no
r config set activedefrag no
r config set active-defrag-threshold-lower 5
r config set active-defrag-threshold-lower 5
r config set active-defrag-cycle-min
2
5
r config set active-defrag-cycle-min
6
5
r config set active-defrag-cycle-max 75
r config set active-defrag-cycle-max 75
r config set active-defrag-ignore-bytes 2mb
r config set active-defrag-ignore-bytes 2mb
r config set maxmemory 100mb
r config set maxmemory 100mb
...
@@ -66,9 +66,10 @@ start_server {tags {"defrag"}} {
...
@@ -66,9 +66,10 @@ start_server {tags {"defrag"}} {
}
}
# Wait for the active defrag to stop working.
# Wait for the active defrag to stop working.
wait_for_condition 1
0
0 100
{
wait_for_condition 1
5
0 100
{
[
s active_defrag_running
]
eq 0
[
s active_defrag_running
]
eq 0
}
else
{
}
else
{
after 120
;
# serverCron only updates the info once in 100ms
puts
[
r info memory
]
puts
[
r info memory
]
puts
[
r memory malloc-stats
]
puts
[
r memory malloc-stats
]
fail
"defrag didn't stop."
fail
"defrag didn't stop."
...
@@ -175,6 +176,7 @@ start_server {tags {"defrag"}} {
...
@@ -175,6 +176,7 @@ start_server {tags {"defrag"}} {
wait_for_condition 500 100
{
wait_for_condition 500 100
{
[
s active_defrag_running
]
eq 0
[
s active_defrag_running
]
eq 0
}
else
{
}
else
{
after 120
;
# serverCron only updates the info once in 100ms
puts
[
r info memory
]
puts
[
r info memory
]
puts
[
r memory malloc-stats
]
puts
[
r memory malloc-stats
]
fail
"defrag didn't stop."
fail
"defrag didn't stop."
...
...
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