Skip to content

Commit

Permalink
Fix problems with invalid trailing commas
Browse files Browse the repository at this point in the history
Also add an estimate for the cpu load if 10 transactions per second are coming in to each roxie node

Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 24, 2024
1 parent 3725ef2 commit 9a9cd12
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tools/roxie/extract-roxie-timings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def calculateDerivedStats(curRow):

timeLocalCpu = timeLocalExecute - timeAgentWait - timeSoapcall
timeRemoteCpu = timeAgentProcess - timeLeafRead - timeBranchRead
workerCpuLoad = timeRemoteCpu / timeAgentProcess
workerCpuLoad = timeRemoteCpu / timeAgentProcess if timeAgentProcess else 0

if numLeafHits + numLeafAdds:
curRow["%LeafMiss"] = 100*numLeafAdds/(numLeafAdds+numLeafHits)
Expand Down Expand Up @@ -85,19 +85,25 @@ def calculateSummaryStats(curRow, numCpus, numRows):

timeLocalCpu = float(curRow.get("TimeLocalCpu", 0.0))
timeRemoteCpu = float(curRow.get("TimeRemoteCpu", 0.0))
timeTotalCpu = timeLocalCpu + timeRemoteCpu
workerCpuLoad = float(curRow.get("WorkerCpuLoad", 0.0))

timeQueryResponseSeconds = float(curRow.get("elapsed", 0.0)) / 1000
avgTimeQueryResponseSeconds = timeQueryResponseSeconds / numRows if numRows else 0

maxTransactionsPerSecond = numCpus * 1000 * numRows / (timeLocalCpu + timeRemoteCpu)
maxWorkerThreads = numCpus / workerCpuLoad
maxPerCpuTransactionsPerSecond = 1000 * numRows / timeTotalCpu if timeTotalCpu else 0
maxTransactionsPerSecond = numCpus * maxPerCpuTransactionsPerSecond
maxWorkerThreads = numCpus / workerCpuLoad if workerCpuLoad else 0
maxFarmers = maxTransactionsPerSecond * avgTimeQueryResponseSeconds

curRow["MaxTransactionsPerSecond"] = maxTransactionsPerSecond
curRow["MaxWorkerThreads"] = maxWorkerThreads
curRow["MaxFarmers"] = maxFarmers

#Expected cpu load for 10 transactions per second per node
if maxPerCpuTransactionsPerSecond:
curRow["ExpectedCpuLoad10"] = 10 / maxPerCpuTransactionsPerSecond

def printRow(curRow):

print(f'{curRow["_id_"]}', end='')
Expand Down Expand Up @@ -202,6 +208,9 @@ def printRow(curRow):
continue
allStats[name] = 1
castValue = -1
#Remove any trailing comma that should not be present
if value[-1] == ',':
value = value[0:-1]

#Apply any scaling to the values
matchHMS = hourMinuteSecondPattern.match(value)
Expand Down Expand Up @@ -235,7 +244,7 @@ def printRow(curRow):
curRow[name] = castValue
else:
curRow[name] = value
elif '}' == cur:
elif '}' == cur[0]:
prefix = nesting.pop()

if combineServices:
Expand Down Expand Up @@ -264,6 +273,7 @@ def printRow(curRow):
allStats["MaxTransactionsPerSecond"] = 1
allStats["MaxWorkerThreads"] = 1
allStats["MaxFarmers"] = 1
allStats["ExpectedCpuLoad10"] = 1

# Create a string containing all the stats that were found in the file.
headings = 'id'
Expand Down

0 comments on commit 9a9cd12

Please sign in to comment.