Merge pull request #122 from rchac/setqueues

Allow operator to override number of queues / CPU cores utilized.
This commit is contained in:
Robert Chacón 2022-09-27 09:13:04 -06:00 committed by GitHub
commit 241ef4ccda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -20,7 +20,7 @@ import binpacking
from ispConfig import fqOrCAKE, upstreamBandwidthCapacityDownloadMbps, upstreamBandwidthCapacityUploadMbps, \ from ispConfig import fqOrCAKE, upstreamBandwidthCapacityDownloadMbps, upstreamBandwidthCapacityUploadMbps, \
interfaceA, interfaceB, enableActualShellCommands, \ interfaceA, interfaceB, enableActualShellCommands, \
runShellCommandsAsSudo, generatedPNDownloadMbps, generatedPNUploadMbps, usingXDP runShellCommandsAsSudo, generatedPNDownloadMbps, generatedPNUploadMbps, usingXDP, queuesAvailableOverride
def shell(command): def shell(command):
if enableActualShellCommands: if enableActualShellCommands:
@ -78,13 +78,17 @@ def tearDown(interfaceA, interfaceB):
def findQueuesAvailable(): def findQueuesAvailable():
# Find queues and CPU cores available. Use min between those two as queuesAvailable # Find queues and CPU cores available. Use min between those two as queuesAvailable
if enableActualShellCommands: if enableActualShellCommands:
queuesAvailable = 0 if queuesAvailableOverride == 0:
path = '/sys/class/net/' + interfaceA + '/queues/' queuesAvailable = 0
directory_contents = os.listdir(path) path = '/sys/class/net/' + interfaceA + '/queues/'
for item in directory_contents: directory_contents = os.listdir(path)
if "tx-" in str(item): for item in directory_contents:
queuesAvailable += 1 if "tx-" in str(item):
print("NIC queues:\t\t\t" + str(queuesAvailable)) queuesAvailable += 1
print("NIC queues:\t\t\t" + str(queuesAvailable))
else:
queuesAvailable = queuesAvailableOverride
print("NIC queues (Override):\t\t\t" + str(queuesAvailable))
cpuCount = multiprocessing.cpu_count() cpuCount = multiprocessing.cpu_count()
print("CPU cores:\t\t\t" + str(cpuCount)) print("CPU cores:\t\t\t" + str(cpuCount))
queuesAvailable = min(queuesAvailable,cpuCount) queuesAvailable = min(queuesAvailable,cpuCount)

View File

@ -31,6 +31,9 @@ enableActualShellCommands = True
# Add 'sudo' before execution of any shell commands. May be required depending on distribution and environment. # Add 'sudo' before execution of any shell commands. May be required depending on distribution and environment.
runShellCommandsAsSudo = False runShellCommandsAsSudo = False
# Allows overriding queues / CPU cores used. When set to 0, the max possible queues / CPU cores are utilized. Please leave as 0.
queuesAvailableOverride = 0
# Bandwidth Graphing # Bandwidth Graphing
bandwidthGraphingEnabled = True bandwidthGraphingEnabled = True
influxDBurl = "http://localhost:8086" influxDBurl = "http://localhost:8086"