本文整理汇总了Python中perfrunner.helpers.remote.RemoteHelper.drop_caches方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteHelper.drop_caches方法的具体用法?Python RemoteHelper.drop_caches怎么用?Python RemoteHelper.drop_caches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类perfrunner.helpers.remote.RemoteHelper
的用法示例。
在下文中一共展示了RemoteHelper.drop_caches方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ClusterManager
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import drop_caches [as 别名]
#.........这里部分代码省略.........
for master in self.masters():
for bucket_name in buckets:
self.rest.create_bucket(host_port=master,
name=bucket_name,
ram_quota=ram_quota,
replica_number=replica_number,
replica_index=replica_index,
eviction_policy=eviction_policy,
threads_number=threads_number,
password=password,
proxy_port=proxy_port)
def configure_auto_compaction(self):
compaction_settings = self.test_config.compaction
for master in self.masters():
self.rest.configure_auto_compaction(master, compaction_settings)
def configure_internal_settings(self):
internal_settings = self.test_config.internal_settings
for master in self.masters():
for parameter, value in internal_settings.items():
self.rest.set_internal_settings(master,
{parameter: int(value)})
def configure_xdcr_settings(self):
xdcr_cluster_settings = self.test_config.xdcr_cluster_settings
for master in self.masters():
for parameter, value in xdcr_cluster_settings.items():
self.rest.set_xdcr_cluster_settings(master,
{parameter: int(value)})
def tweak_memory(self):
self.remote.reset_swap()
self.remote.drop_caches()
self.remote.set_swappiness()
self.remote.disable_thp()
def restart_with_alternative_num_vbuckets(self):
num_vbuckets = self.test_config.cluster.num_vbuckets
if num_vbuckets is not None:
self.remote.restart_with_alternative_num_vbuckets(num_vbuckets)
def restart_with_alternative_bucket_options(self):
cmd = 'ns_bucket:update_bucket_props("{}", ' \
'[{{extra_config_string, "{}={}"}}]).'
for option in ('defragmenter_enabled',
'exp_pager_stime',
'ht_locks',
'max_num_shards',
'max_threads',
'warmup_min_memory_threshold',
'bfilter_enabled'):
value = getattr(self.test_config.bucket, option)
if value != -1 and value is not None:
logger.info('Changing {} to {}'.format(option, value))
for master in self.masters():
for bucket in self.test_config.buckets:
diag_eval = cmd.format(bucket, option, value)
self.rest.run_diag_eval(master, diag_eval)
self.remote.restart()
def tune_logging(self):
self.remote.tune_log_rotation()
self.remote.restart()
示例2: ClusterManager
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import drop_caches [as 别名]
#.........这里部分代码省略.........
else:
groups = {}
for i, host_port in enumerate(servers[1:initial_nodes],
start=1):
uri = groups.get(server_group(servers[:initial_nodes],
self.group_number, i))
self.rest.add_node(master, host_port, self.roles[host_port],
uri)
def rebalance(self):
for (_, servers), initial_nodes in zip(self.clusters(),
self.initial_nodes):
master = servers[0]
known_nodes = servers[:initial_nodes]
ejected_nodes = []
self.rest.rebalance(master, known_nodes, ejected_nodes)
self.monitor.monitor_rebalance(master)
self.wait_until_healthy()
def create_buckets(self):
ram_quota = self.mem_quota / self.test_config.cluster.num_buckets
for master in self.masters():
for bucket_name in self.test_config.buckets:
self.rest.create_bucket(
host_port=master,
name=bucket_name,
ram_quota=ram_quota,
password=self.test_config.bucket.password,
replica_number=self.test_config.bucket.replica_number,
replica_index=self.test_config.bucket.replica_index,
eviction_policy=self.test_config.bucket.eviction_policy,
conflict_resolution_type=self.test_config.bucket.conflict_resolution_type,
)
def configure_auto_compaction(self):
compaction_settings = self.test_config.compaction
for master in self.masters():
self.rest.configure_auto_compaction(master, compaction_settings)
settings = self.rest.get_auto_compaction_settings(master)
logger.info('Auto-compaction settings: {}'
.format(pretty_dict(settings)))
def configure_internal_settings(self):
internal_settings = self.test_config.internal_settings
for master in self.masters():
for parameter, value in internal_settings.items():
self.rest.set_internal_settings(master,
{parameter: int(value)})
def configure_xdcr_settings(self):
xdcr_cluster_settings = self.test_config.xdcr_cluster_settings
for master in self.masters():
for parameter, value in xdcr_cluster_settings.items():
self.rest.set_xdcr_cluster_settings(master,
{parameter: int(value)})
def tweak_memory(self):
self.remote.reset_swap()
self.remote.drop_caches()
self.remote.set_swappiness()
self.remote.disable_thp()
def restart_with_alternative_num_vbuckets(self):
num_vbuckets = self.test_config.cluster.num_vbuckets
if num_vbuckets is not None:
self.remote.restart_with_alternative_num_vbuckets(num_vbuckets)
def restart_with_alternative_bucket_options(self):
"""Apply custom buckets settings (e.g., max_num_shards or max_num_auxio)
using "/diag/eval" and restart the entire cluster."""
cmd = 'ns_bucket:update_bucket_props("{}", ' \
'[{{extra_config_string, "{}={}"}}]).'
for option, value in self.test_config.bucket_extras.items():
logger.info('Changing {} to {}'.format(option, value))
for master in self.masters():
for bucket in self.test_config.buckets:
diag_eval = cmd.format(bucket, option, value)
self.rest.run_diag_eval(master, diag_eval)
if self.test_config.bucket_extras:
self.remote.restart()
self.wait_until_healthy()
def tune_logging(self):
self.remote.tune_log_rotation()
self.remote.restart()
def enable_auto_failover(self):
for master in self.masters():
self.rest.enable_auto_failover(master)
def wait_until_warmed_up(self):
for master in self.cluster_spec.yield_masters():
for bucket in self.test_config.buckets:
self.monitor.monitor_warmup(self.memcached, master, bucket)
def wait_until_healthy(self):
for master in self.cluster_spec.yield_masters():
self.monitor.monitor_node_health(master)
示例3: __init__
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import drop_caches [as 别名]
#.........这里部分代码省略.........
name=self.test_config.cluster.EVENTING_METADATA_BUCKET_NAME,
ram_quota=self.test_config.cluster.eventing_metadata_bucket_mem_quota,
password=self.test_config.bucket.password,
replica_number=self.test_config.bucket.replica_number,
replica_index=self.test_config.bucket.replica_index,
eviction_policy=self.test_config.bucket.EVICTION_POLICY,
bucket_type=self.test_config.bucket.BUCKET_TYPE,
)
def configure_auto_compaction(self):
compaction_settings = self.test_config.compaction
for master in self.cluster_spec.masters:
self.rest.configure_auto_compaction(master, compaction_settings)
settings = self.rest.get_auto_compaction_settings(master)
logger.info('Auto-compaction settings: {}'
.format(pretty_dict(settings)))
def configure_internal_settings(self):
internal_settings = self.test_config.internal_settings
for master in self.cluster_spec.masters:
for parameter, value in internal_settings.items():
self.rest.set_internal_settings(master,
{parameter: maybe_atoi(value)})
def configure_xdcr_settings(self):
xdcr_cluster_settings = self.test_config.xdcr_cluster_settings
for master in self.cluster_spec.masters:
for parameter, value in xdcr_cluster_settings.items():
self.rest.set_xdcr_cluster_settings(master,
{parameter: maybe_atoi(value)})
def tweak_memory(self):
self.remote.reset_swap()
self.remote.drop_caches()
self.remote.set_swappiness()
self.remote.disable_thp()
def restart_with_alternative_num_vbuckets(self):
num_vbuckets = self.test_config.cluster.num_vbuckets
if num_vbuckets is not None:
self.remote.restart_with_alternative_num_vbuckets(num_vbuckets)
def restart_with_alternative_bucket_options(self):
"""Apply custom buckets settings.
Tune bucket settings (e.g., max_num_shards or max_num_auxio) using
"/diag/eval" and restart the entire cluster.
"""
if self.test_config.bucket_extras:
self.remote.enable_nonlocal_diag_eval()
cmd = 'ns_bucket:update_bucket_props("{}", ' \
'[{{extra_config_string, "{}={}"}}]).'
for option, value in self.test_config.bucket_extras.items():
logger.info('Changing {} to {}'.format(option, value))
for master in self.cluster_spec.masters:
for bucket in self.test_config.buckets:
diag_eval = cmd.format(bucket, option, value)
self.rest.run_diag_eval(master, diag_eval)
if self.test_config.bucket_extras:
self.remote.restart()
self.wait_until_healthy()
def tune_logging(self):
示例4: ClusterManager
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import drop_caches [as 别名]
#.........这里部分代码省略.........
if self.group_number > 1:
groups = self.rest.get_server_groups(master)
else:
groups = {}
for i, host_port in enumerate(servers[1:initial_nodes],
start=1):
host = host_port.split(':')[0]
uri = groups.get(server_group(servers[:initial_nodes],
self.group_number, i))
self.rest.add_node(master, host, uri)
# Rebalance
master = servers[0]
known_nodes = servers[:initial_nodes]
ejected_nodes = []
self.rest.rebalance(master, known_nodes, ejected_nodes)
self.monitor.monitor_rebalance(master)
def create_buckets(self):
ram_quota = self.mem_quota / self.test_config.cluster.num_buckets
replica_number = self.test_config.bucket.replica_number
replica_index = self.test_config.bucket.replica_index
eviction_policy = self.test_config.bucket.eviction_policy
threads_number = self.test_config.bucket.threads_number
for master in self.masters():
for bucket_name in self.test_config.buckets:
self.rest.create_bucket(host_port=master,
name=bucket_name,
ram_quota=ram_quota,
replica_number=replica_number,
replica_index=replica_index,
eviction_policy=eviction_policy,
threads_number=threads_number,
)
def configure_auto_compaction(self):
compaction_settings = self.test_config.compaction
for master in self.masters():
self.rest.configure_auto_compaction(master, compaction_settings)
def configure_internal_settings(self):
internal_settings = self.test_config.internal_settings
for master in self.masters():
for parameter, value in internal_settings.items():
self.rest.set_internal_settings(master,
{parameter: int(value)})
def tweak_memory(self):
self.remote.reset_swap()
self.remote.drop_caches()
self.remote.set_swappiness()
self.remote.disable_thp()
def restart_with_alternative_num_vbuckets(self):
num_vbuckets = self.test_config.cluster.num_vbuckets
if num_vbuckets is not None:
self.remote.restart_with_alternative_num_vbuckets(num_vbuckets)
def restart_with_alternative_bucket_options(self):
cmd = 'ns_bucket:update_bucket_props("{}", ' \
'[{{extra_config_string, "{}={}"}}]).'
for option in ('max_num_shards', 'max_threads'):
value = getattr(self.test_config.bucket, option)
if value:
logger.info('Changing {} to {}'.format(option, value))
for master in self.masters():
for bucket in self.test_config.buckets:
diag_eval = cmd.format(bucket, option, value)
self.rest.run_diag_eval(master, diag_eval)
self.remote.restart()
def restart_with_alternative_num_cpus(self):
num_cpus = self.test_config.cluster.num_cpus
if num_cpus:
self.remote.restart_with_alternative_num_cpus(num_cpus)
def enable_auto_failover(self):
for master in self.masters():
self.rest.enable_auto_failover(master)
def wait_until_warmed_up(self):
target_iterator = TargetIterator(self.cluster_spec, self.test_config)
for target in target_iterator:
host = target.node.split(':')[0]
self.monitor.monitor_warmup(self.memcached, host, target.bucket)
def change_watermarks(self):
watermark_settings = self.test_config.watermark_settings
for hostname, initial_nodes in zip(self.hostnames(),
self.initial_nodes):
for bucket in self.test_config.buckets:
for key, val in watermark_settings.items():
val = self.memcached.calc_watermark(val, self.mem_quota)
self.memcached.set_flusher_param(hostname, bucket, key, val)
def start_cbq_engine(self):
if self.test_config.cluster.run_cbq:
self.remote.start_cbq()
示例5: RestoreHelper
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import drop_caches [as 别名]
class RestoreHelper(object):
def __init__(self, cluster_spec, test_config, verbose):
self.cluster_spec = cluster_spec
self.test_config = test_config
self.verbose = verbose
self.snapshot = self.test_config.restore_settings.snapshot
self.remote = RemoteHelper(self.cluster_spec, self.test_config,
self.verbose)
def fetch_maps(self):
rest = RestHelper(self.cluster_spec)
master_node = self.cluster_spec.yield_masters().next()
maps = {}
for bucket in self.test_config.buckets:
vbmap = rest.get_vbmap(master_node, bucket)
server_list = rest.get_server_list(master_node, bucket)
maps[bucket] = (vbmap, server_list)
return maps
def cp(self, server, cmd):
logger.info('Restoring files on {}'.format(server))
with settings(host_string=server,
user=self.cluster_spec.ssh_credentials[0],
password=self.cluster_spec.ssh_credentials[1]):
run(cmd)
def restore(self):
maps = self.fetch_maps()
self.remote.stop_server()
threads = []
for bucket, (vbmap, server_list) in maps.items():
files = defaultdict(list)
for vb_idx, nodes in enumerate(vbmap):
for node_idx in nodes:
files[server_list[node_idx]].append(vb_idx)
for server, vbuckets in files.items():
cmd = 'cp '
for vbucket in vbuckets:
cmd += '{}/{}.couch.1 '.format(self.snapshot, vbucket)
cmd += '/data/{}'.format(bucket)
threads.append(Thread(target=self.cp, args=(server, cmd)))
for t in threads:
t.start()
time.sleep(1)
for t in threads:
t.join()
state.connections.clear()
self.remote.drop_caches()
self.remote.start_server()
def warmup(self):
cm = ClusterManager(self.cluster_spec, self.test_config, self.verbose)
cm.wait_until_warmed_up()
cm.wait_until_healthy()