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

[INDY-1582] add median for calculating average throughput and latency for backups #871

Merged
merged 5 commits into from
Aug 16, 2018

Conversation

lampkin-diet
Copy link

No description provided.

Andrew Nikitin added 4 commits August 13, 2018 16:04
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
"{}'s master's avg request latency is {} and backup's "
"avg request latency is {}".format(self, avgLatM, avgLatB))
return True
if latencies:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not latencies:
continue

high_avg_lat = self.latency_avg_strategy_cls.get_avg(latencies)
avg_master_lat = avgLatM[cid]
if avg_master_lat - high_avg_lat < self.Omega:
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue instead of return?

avg_master_lat = avgLatM[cid]
if avg_master_lat - high_avg_lat < self.Omega:
return False
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant else sine continue/return is above

return False
else:
d = avg_master_lat - high_avg_lat
logger.info("{}{} found difference between master's and "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why two logs (info and warning) here? Please combine to one (info level)


# If latency of the master for any client is greater than that of
# backups by more than the threshold `Omega`, then a view change
# needs to happen
for cid, lat in avgLatB.items():
for cid, latencies in avgLatB.items():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to check it for each client? Maybe average is enough?
When do we clear latency for each client? Is it a long operation to loop over all cids?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for lat_item in [self.monitor.getLatencies(instId) for instId in self.instances.backupIds]:
for cid, lat in lat_item.items():
backup_latencies.setdefault(cid, []).append(lat)
backup_latencies = [mean(lat) for cid, lat in backup_latencies.items()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We show mean value here (for all clients), while monitor checks it for each client independently.

@@ -38,11 +40,12 @@ def testReqLatencyThreshold(looper, txnPoolNodeSet, requests):
assert node.monitor.masterReqLatenciesTest[key] <= node.monitor.Lambda


@pytest.mark.skip(reason="Logic is checked in unit tests")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the test then?

Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
@ashcherbakov ashcherbakov merged commit 1f2ea5a into hyperledger:master Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants