-
Notifications
You must be signed in to change notification settings - Fork 6
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
Request for Enhancement: X-Road Metrics version 2.x #155
Comments
Milestone 1Regarding Milestone 1, I tried multiple approaches and found out that the simplest one is to move the non-released modules into a nested folder and disable any files that would cause Github or dependabot to consider the folders as python applications. Alternate OptionsOption 1Conclusion: Causes a lot of hidden irreversible issues that are usually not noticed until it's too late (according to official doc and articles online) Use git filter-branch. Sounded very promising until read the warnings. Option 2Conclusion: A big no go in our use-case. The previous option points to git-filter-repo as a replacement. Options 3Conclusion: if really needed, can be done, but has drawbacks and seems to be overkill in our case. Move each of non-released modules into its own incubation branch using git subtree command. |
If a proper rewrite is considered for X-Road Metrics, performance and optimization issues should be addressed. The application currently fulfills its purpose but scales poorly as the volume of X-Road queries increases. For example, three months of Estonian X-tee data requires 1TB of storage, with half occupied by indexes. Some commonly used indexes reach 40GB in size, and multiple indexes are utilized concurrently. While MongoDB is optimized for in-memory operations, it's infeasible to allocate hundreds of gigabytes of memory exclusively for MongoDB. A machine with 64GB of RAM struggles to process new metrics due to excessive I/O operations, as it cannot hold all required indexes in memory. MongoDB might not be the ideal database for X-Road Metrics. However, when considering alternatives, it's crucial to acknowledge that any other database optimized for fast ingestion and less frequent updates would likely face similar challenges. A typical sequence of database operations to ingest metrics data into MongoDB is as follows:
Some steps in this process are redundant. For example, processed documents in raw_messages could be directly deleted. Alternatively, it could be considered to bypass the raw_messages collection altogether and directly passing data from the collector to the corrector. This would slightly slow down the collection process but significantly reduce overall disk I/O. Deleting old documents from the database is a very slow operation. Deleting a single day's worth of data can take hours. The primary issue is that MongoDB does not support table partitioning. This prevents the deletion of an entire month/week/day instantly, necessitating slow search/delete operations within MongoDB. The current data model is also suboptimal. Client and producer data are separated into different sub-elements, and one of these sub-elements may be missing. This requires up to four separate searches for many operations, especially during report generation, instead of a single search. Furthermore, storing duplicate data in both client and producer elements introduces overhead. A more efficient approach would involve:
This structure would minimize the number of searches required and eliminate unnecessary conditions and checks for the existence of client or producer elements. Report generation also necessitates optimization. Due to the inability of indexes to fit into memory, generating reports for members with numerous queries can be as slow as a full collection scan. Performing a single full scan and aggregating data for each member instead should be considered. Database support for partitioning would also significantly improve performance by reducing index sizes and eliminating the need to process data from previous months. Currently, X-Road Metrics does not provide Kibana/Grafana visualizations and searches. The Estonian X-Road center synchronizes data from MongoDB to Elasticsearch and utilizes Kibana for problem identification and visualization of X-Road usage statistics. If major changes are implemented, the synchronization process may need to be adjusted. If the database is replaced, a new synchronization solution would be required. However, this should not be considered a major obstacle, as optimizing X-Road Metrics can significantly reduce hardware resource consumption. |
TL;DR
Current implementation of X-Road Metrics, although working properly and performing very well, has many pain-points from administration, security, and development point-of-views.
Proposed solution is to migrate existing applications from CLI-based applications into microservices architecture with AdminUI and UserUI components.
Detailed Edition
Background information
Current implementation of X-Road Metrics, although working properly and performing very well, has the following pain-points from administration, security, and development point-of-views.
Administration point-of-view
Collector
module has scripts to create MongoDB's users, collections, and indexesOpenData
module has script to create PostegeSQL' usersAnonymizer
module creates the PostegeSQL' tablesCollector
haslist
,collect
, andupdate
, whileAnonymizer
has only one. The issue is, these operations are not clear to the administrator.Security point-of-view
This issue actually prevents some of the Kubernetes-based runtime, e.g., OpenShift, from running the images without workarounds that some organizations consider a big risk.
Development point-of-view
R
language. Maintaining these different technical stacks in one repository is difficult affecting the cost of maintenance and adding new features.Important
Although each of the previous pain points can be addressed individually, it's really hard and time consuming given the current state. (I tried 😞 )
Metrics Version 2.0
The proposed solution is:
Networking
.Collector
,Corrector
,Reports
, andAnonymizer
applications.OpenData
andNetworking
)UserUI
and its proxy is in the DMZ zone whileOpenData
andNetworking
deployed in the internal network.Notes:
Sharing my thoughts about this point:
This way, we can support any OS and be more flexible.
The proposed solution will inherently provide the following fixes as well
Additional items to include
main
. i.e., Moveanalysis_module
,analysis_ui_module
,archive_module
,opendata_collector_module
to aincubation
branch for enhanced clarity and maintainability.Proposed Architecture:
Proposed Milestones/plan:
incubation
branch.This milestone should be easy to accomplish and would be an easy win. Admins can use Swagger at this stage
Collector
,Corrector
,Reports
, andAnonymizer
applications into FastAPI microservicesAdministration
moduleAdminUI
OpenData
to FastAPIUserUI
Networking
to FastAPIUserUI
The text was updated successfully, but these errors were encountered: