mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 09:17:20 +00:00
support for blocking VM in config file
This commit is contained in:
parent
f2d9f50f6c
commit
72e9fd40b6
1
TODO
1
TODO
@ -16,6 +16,7 @@ Virtual Memory sub-TODO:
|
|||||||
* Divide swappability of objects by refcount
|
* Divide swappability of objects by refcount
|
||||||
* vm-swap-file <filename>. The swap file should go where the user wants, and if it's already there and of the right size we can avoid to create it again.
|
* vm-swap-file <filename>. The swap file should go where the user wants, and if it's already there and of the right size we can avoid to create it again.
|
||||||
* it should be possible to give the vm-max-memory option in megabyte, gigabyte, ..., just using 2GB, 100MB, and so forth.
|
* it should be possible to give the vm-max-memory option in megabyte, gigabyte, ..., just using 2GB, 100MB, and so forth.
|
||||||
|
* Make sure to wait all the IO threads are done before to fork() for BGSAVE and BGREWRITEAOF
|
||||||
|
|
||||||
VERSION 1.6 TODO (Virtual memory)
|
VERSION 1.6 TODO (Virtual memory)
|
||||||
=================================
|
=================================
|
||||||
|
25
redis.c
25
redis.c
@ -1262,18 +1262,23 @@ static int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientD
|
|||||||
while (server.vm_enabled && zmalloc_used_memory() >
|
while (server.vm_enabled && zmalloc_used_memory() >
|
||||||
server.vm_max_memory)
|
server.vm_max_memory)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
if (tryFreeOneObjectFromFreelist() == REDIS_OK) continue;
|
if (tryFreeOneObjectFromFreelist() == REDIS_OK) continue;
|
||||||
if (vmSwapOneObjectThreaded() == REDIS_ERR) {
|
retval = (server.vm_max_threads == 0) ?
|
||||||
if ((loops % 30) == 0 && zmalloc_used_memory() >
|
vmSwapOneObjectBlocking() :
|
||||||
(server.vm_max_memory+server.vm_max_memory/10)) {
|
vmSwapOneObjectThreaded();
|
||||||
redisLog(REDIS_WARNING,"WARNING: vm-max-memory limit exceeded by more than 10%% but unable to swap more objects out!");
|
if (retval == REDIS_ERR && (loops % 30) == 0 &&
|
||||||
}
|
zmalloc_used_memory() >
|
||||||
|
(server.vm_max_memory+server.vm_max_memory/10))
|
||||||
|
{
|
||||||
|
redisLog(REDIS_WARNING,"WARNING: vm-max-memory limit exceeded by more than 10%% but unable to swap more objects out!");
|
||||||
}
|
}
|
||||||
/* Note that we freed just one object, because anyway when
|
/* Note that when using threade I/O we free just one object,
|
||||||
* the I/O thread in charge to swap this object out will
|
* because anyway when the I/O thread in charge to swap this
|
||||||
* do its work, the handler of completed jobs will try to swap
|
* object out will finish, the handler of completed jobs
|
||||||
* more objects if we are out of memory. */
|
* will try to swap more objects if we are still out of memory. */
|
||||||
break;
|
if (retval == REDIS_ERR || server.vm_max_threads > 0) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,6 +222,9 @@ vm-pages 104857600
|
|||||||
# number of threads can help with big objects even if they can't help with
|
# number of threads can help with big objects even if they can't help with
|
||||||
# I/O itself as the physical device may not be able to couple with many
|
# I/O itself as the physical device may not be able to couple with many
|
||||||
# reads/writes operations at the same time.
|
# reads/writes operations at the same time.
|
||||||
|
#
|
||||||
|
# The special value of 0 turn off threaded I/O and enables the blocking
|
||||||
|
# Virtual Memory implementation.
|
||||||
vm-max-threads 4
|
vm-max-threads 4
|
||||||
|
|
||||||
############################### ADVANCED CONFIG ###############################
|
############################### ADVANCED CONFIG ###############################
|
||||||
|
Loading…
Reference in New Issue
Block a user