Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aerospike: Use vm.num_cpus where recommended. #360

Merged
merged 3 commits into from
Jul 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions perfkitbenchmarker/benchmarks/aerospike_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ def _PrepareServer(server):
else:
devices = [scratch_disk.GetDevicePath()
for scratch_disk in server.scratch_disks]
else:
devices = []

server.RenderTemplate(data.ResourcePath('aerospike.conf.j2'),
aerospike_server.AEROSPIKE_CONF_PATH,
{'devices': devices})
server.RenderTemplate(data.ResourcePath('aerospike.conf.j2'),
aerospike_server.AEROSPIKE_CONF_PATH,
{'devices': devices})

for scratch_disk in server.scratch_disks:
server.RemoteCommand('sudo umount %s' % scratch_disk.mount_point)
Expand Down
29 changes: 17 additions & 12 deletions perfkitbenchmarker/data/aerospike.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
service {
run-as-daemon false
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
service-threads 4
transaction-queues 4
service-threads {{ vm.num_cpus }}
transaction-queues {{ vm.num_cpus }}
transaction-threads-per-queue 4
# Note: The number of concurrent connections to the database is limited by "proto-fd-max",
# which is in turn limited by the system's maximum number of open file descriptors.
Expand Down Expand Up @@ -63,16 +63,21 @@ network {
}

namespace test {
replication-factor 2
memory-size 4G
default-ttl 30d # 30 days, use 0 to never expire/evict.
storage-engine device { # Configure the storage-engine to use persistence
{% for device_path in devices %}
device {{ device_path }}
{% endfor %}
write-block-size 128K # adjust block size to make it efficient for SSDs
disable-odirect true
}
replication-factor 2
memory-size 4G
default-ttl 30d # 30 days, use 0 to never expire/evict.
{# if storage devices are passed to the template, use them for storage; otherwise use memory. -#}
{% if devices %}
storage-engine device { # Configure the storage-engine to use persistence
{% for device_path in devices %}
device {{ device_path }}
{% endfor %}
write-block-size 128K # adjust block size to make it efficient for SSDs
disable-odirect true
}
{% else %}
storage-engine memory
{% endif %}
}

namespace bar {
Expand Down
3 changes: 2 additions & 1 deletion perfkitbenchmarker/virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ def RenderTemplate(self, template_path, remote_path, context):
template = environment.from_string(template_contents)
prefix = 'pkb-' + os.path.basename(template_path)

with vm_util.NamedTemporaryFile(prefix=prefix) as tf:
with vm_util.NamedTemporaryFile(prefix=prefix, dir=vm_util.GetTempDir(),
delete=False) as tf:
tf.write(template.render(vm=self, **context))
tf.close()
self.RemoteCopy(tf.name, remote_path)
Expand Down
5 changes: 3 additions & 2 deletions perfkitbenchmarker/vm_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def GetLastRunUri():


@contextlib.contextmanager
def NamedTemporaryFile(prefix='tmp', suffix='', dir=None):
def NamedTemporaryFile(prefix='tmp', suffix='', dir=None, delete=True):
"""Behaves like tempfile.NamedTemporaryFile.

The existing tempfile.NamedTemporaryFile has the annoying property on
Expand All @@ -539,7 +539,8 @@ def NamedTemporaryFile(prefix='tmp', suffix='', dir=None):
finally:
if not f.closed:
f.close()
os.unlink(f.name)
if delete:
os.unlink(f.name)


def GenerateSSHConfig(vms):
Expand Down