The calculation of maxval for session knobs that use memory/storage resources is now set to 80% of the available resource (versus 100%)

This commit is contained in:
Dana Van Aken 2019-10-08 05:07:45 -04:00
parent c568c09c00
commit 3d70990ff1
1 changed files with 25 additions and 7 deletions

View File

@ -10,8 +10,8 @@ from .types import DBMSType, KnobResourceType, VarType
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
GB = 1024 ** 3 # Default tunable knobs by DBMS. If a DBMS is not listed here, the set of
# tunable knobs in the KnobCatalog will be used instead.
DEFAULT_TUNABLE_KNOBS = { DEFAULT_TUNABLE_KNOBS = {
DBMSType.POSTGRES: { DBMSType.POSTGRES: {
"global.checkpoint_completion_target", "global.checkpoint_completion_target",
@ -27,6 +27,24 @@ DEFAULT_TUNABLE_KNOBS = {
} }
} }
# Bytes in a GB
GB = 1024 ** 3
# Default minval when set to None
MINVAL = 0
# Default maxval when set to None
MAXVAL = 192 * GB
# Percentage of total CPUs to use for maxval
CPU_PERCENT = 2.0
# Percentage of total memory to use for maxval
MEMORY_PERCENT = 0.8
# Percentage of total storage to use for maxval
STORAGE_PERCENT = 0.8
def set_default_knobs(session): def set_default_knobs(session):
dbtype = session.dbms.type dbtype = session.dbms.type
@ -43,15 +61,15 @@ def set_default_knobs(session):
if knob.vartype in (VarType.INTEGER, VarType.REAL): if knob.vartype in (VarType.INTEGER, VarType.REAL):
vtype = int if knob.vartype == VarType.INTEGER else float vtype = int if knob.vartype == VarType.INTEGER else float
minval = vtype(minval) minval = vtype(minval) if minval is not None else MINVAL
knob_maxval = vtype(knob.maxval) knob_maxval = vtype(knob.maxval) if knob.maxval is not None else MAXVAL
if knob.resource == KnobResourceType.CPU: if knob.resource == KnobResourceType.CPU:
maxval = session.hardware.cpu * 2 maxval = session.hardware.cpu * CPU_PERCENT
elif knob.resource == KnobResourceType.MEMORY: elif knob.resource == KnobResourceType.MEMORY:
maxval = session.hardware.memory * GB maxval = session.hardware.memory * GB * MEMORY_PERCENT
elif knob.resource == KnobResourceType.STORAGE: elif knob.resource == KnobResourceType.STORAGE:
maxval = session.hardware.storage * GB maxval = session.hardware.storage * GB * STORAGE_PERCENT
else: else:
maxval = knob_maxval maxval = knob_maxval