Skip to content

Instantly share code, notes, and snippets.

@codedeep79
Created August 10, 2025 06:17
Show Gist options
  • Save codedeep79/5420f7fc3e520ded6dba9362fc9825be to your computer and use it in GitHub Desktop.
Save codedeep79/5420f7fc3e520ded6dba9362fc9825be to your computer and use it in GitHub Desktop.
Tạo mẫu file scylla.yaml tối ưu dựa trên input phần cứng (CPU core, RAM, NVMe, NUMA).
def generate_scylla_yaml(n_cpu, ram_gb, n_nvme, numa_nodes, use_row_cache=True):
ram_mb = ram_gb * 1024
memory = int(ram_mb * 0.7)
memtable_heap = int(memory * 0.25)
row_cache = 8192 if use_row_cache else 0
num_io_queues = n_nvme * numa_nodes
compaction_throughput = 256
yaml = f"""\
# Generated ScyllaDB configuration sample
smp: {n_cpu}
memory: {memory} # MB
num_io_queues: {num_io_queues}
commitlog_sync: batch
commitlog_sync_batch_window_in_ms: 2
commitlog_segment_size_in_mb: 64
memtable_heap_space_in_mb: {memtable_heap}
row_cache_size_in_mb: {row_cache}
compaction_throughput_mb_per_sec: {compaction_throughput}
# Network
listen_address: <your_node_ip_here>
rpc_address: 0.0.0.0
# Add other config options as needed
"""
return yaml
if __name__ == "__main__":
print("Enter ScyllaDB hardware config:")
n_cpu = int(input("Number of CPU cores dedicated to Scylla: "))
ram_gb = int(input("Total RAM in GB: "))
n_nvme = int(input("Number of NVMe/SSD devices: "))
numa_nodes = int(input("Number of NUMA nodes: "))
use_cache_input = input("Use row cache? (y/n): ").strip().lower()
use_row_cache = use_cache_input == 'y'
config = generate_scylla_yaml(n_cpu, ram_gb, n_nvme, numa_nodes, use_row_cache)
print("\n===== Generated scylla.yaml sample =====\n")
print(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment