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

Dashboard does not use metrics anymore #1333

Merged
merged 17 commits into from
Dec 22, 2023

Conversation

bchamagne
Copy link
Contributor

@bchamagne bchamagne commented Nov 28, 2023

Description

With 21 nodes, we used to transmit more than 100GB per node per day to display the dashboard.

Before: 21 nodes * 300KB of data * 720 requests per hour * 24 hours = 100GB
After: 21 nodes * 4KB of data * 60 requests per hour * 24 hours = 121MB

I removed the fetching of metrics from nodes to nodes and replaced it with 2 new processes:

  • DashboardMetrics listens to local events and keep them in buckets
  • DashboardMetricsAggregator request regularly other nodes for their DashboardAggregator data

The aggregation is currently set to 1 minute and we keep 60 minutes of history. This way the dashboard can display the last hour of data as soon as we hit the page.

We could do smaller buckets / longer history if the need arises.

Fixes #1182

Capture d’écran 2023-12-19 à 18 33 13

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests + tested locally with 4 nodes

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bchamagne bchamagne added this to the 1.5.0 milestone Nov 30, 2023
Copy link
Member

@Neylix Neylix left a comment

Choose a reason for hiding this comment

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

For the naming you could rename DashboardAggregator to DashboardMetrics and DashboardAggregatorAggregator to DashboardMetricsAggregator it looks nicer I think

lib/archethic_web/dashboard_aggregator.ex Outdated Show resolved Hide resolved
lib/archethic_web/dashboard_aggregator_aggregator.ex Outdated Show resolved Hide resolved
lib/archethic_web/dashboard_aggregator_aggregator.ex Outdated Show resolved Hide resolved
lib/archethic_web/explorer/live/dashboard_live.ex Outdated Show resolved Hide resolved
test/archethic_web/dashboard_aggregator_test.exs Outdated Show resolved Hide resolved
@Neylix
Copy link
Member

Neylix commented Dec 14, 2023

I also have weird behavior running 2 nodes:

image

Also there is something wrong in the calculation of number of transaction. Currently for a bucket of a timestamp you create a list of all the durations of all nodes, but some durations of different node refer the same transaction, so if you have only one transaction processed by 3 nodes you'll say there where 3 transactions processed in the graph while in fact there were only 1 transaction.

A solution could be to have a map with transaction address => duration, so you could easily calculate the real number of transaction, and it would also be a more accurate calculation of the average transaction validation time

@bchamagne bchamagne modified the milestones: 1.5.0, 1.4.3 Dec 20, 2023
@bchamagne
Copy link
Contributor Author

Capture d’écran 2023-12-20 à 19 36 38

@bchamagne
Copy link
Contributor Author

Capture d’écran 2023-12-21 à 20 21 37

bchamagne added 2 commits December 21, 2023 20:34
- Boxplot of validation duration
- Tx count per node within last hour
@Neylix Neylix merged commit 4b48fc8 into archethic-foundation:develop Dec 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics fetching consume too much network data
2 participants