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

Feature/move to fastify #3618

Merged
merged 18 commits into from
May 13, 2024
Merged

Feature/move to fastify #3618

merged 18 commits into from
May 13, 2024

Conversation

ihar-tsykala
Copy link
Collaborator

Description:

Moved api-gateway on nest + fastify platform

Related issue(s):

Checklist

  • Checked on localhost
  • Tested (unit, integration, etc.)

@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from ced6b4e to 7ff59cb Compare May 3, 2024 15:27
@ihar-tsykala ihar-tsykala requested review from simvalery and Pyatakov May 3, 2024 15:29
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from dbcf2b9 to aeac7d2 Compare May 7, 2024 15:44
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 4b29971 to 136410a Compare May 7, 2024 15:49
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 539f479 to ac07103 Compare May 8, 2024 10:41
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 5ba49f6 to 84bbfd2 Compare May 8, 2024 11:47
Copy link

github-actions bot commented May 8, 2024

Unit Test Results

111 files  ±0  220 suites  ±0   48m 3s ⏱️ + 3m 21s
192 tests ±0  192 ✔️ ±0  0 💤 ±0  0 ±0 
195 runs  ±0  195 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 02a77e3. ± Comparison against base commit f9c57aa.

♻️ This comment has been updated with latest results.

@prernaadev01
Copy link
Collaborator

@mattsmithies As discussed in today's Tech Meet, wanted to loop you in this discussion.

@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 1af0ca0 to f3e9516 Compare May 8, 2024 15:06
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch 3 times, most recently from 0914904 to 932fb69 Compare May 10, 2024 16:13
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 932fb69 to b5589d6 Compare May 10, 2024 20:56
@ihar-tsykala
Copy link
Collaborator Author

@mattsmithies As discussed in today's Tech Meet, wanted to loop you in this discussion.

Hello @mattsmithies I heard that you would like us to prioritize database optimizations over fastify.
I'm glad to inform you that our team is constantly thinking about this and seeking solutions.
We're almost done with transitioning to the Fastify platform. Testing and bug fixing are currently in the final stages. I hope that next week we'll merge this pull request into the develop branch.
In addition, we've implemented request caching to offload the database. Currently, we're working on an improvement by adding invalidation. This will make us even more flexible, allowing us to wrap more requests in cache interceptor and make our platform even faster.
We've also put in a lot of effort and transitioned to ESM (ECMAScript Modules) scripts, which will enable us to be compatible with more modern external modules in the future.
And of course, we've optimized our Docker build, which allows for faster and more convenient work with the platform.
We are fully focused on finding new solutions for optimization and would be glad to hear any suggestions from you. Discussing them would be a great honor for the team.

@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from b5589d6 to 4139242 Compare May 10, 2024 21:55
@ihar-tsykala ihar-tsykala force-pushed the feature/move-to-fastify branch from 4139242 to 02a77e3 Compare May 11, 2024 15:50
@mattsmithies
Copy link
Contributor

Hey @ihar-tsykala, thank you for bringing me into this thread. I appreciate your efforts in understanding my perspective on these developments.

While I recognize the potential benefits of integrating the Fastify framework for improving performance, I remain a little skeptical about its impact on the current needs of the community. Typically, optimizations like these are most beneficial for systems handling millions of transactions, aiming to scale significantly. Nonetheless, the ultimate goal is to prepare Guardian for such scalability.

Regarding the prioritization of a robust caching process at this stage, I understand that it presents a quick win. However, considering the relatively low throughput our Guardian systems currently experience, optimizing database interactions might not be the most immediate bottleneck. It's noteworthy that cache invalidation, as referenced in #3641, remains a challenge due to the stateful nature of the API.

I want to provide some context on my recent work with Guardian, which I've been closely involved with since its alpha phase nearly three years ago. We are now developing our third bespoke API client specifically tailored for Guardian's unique needs.

This week, I plan to create extensive documentation addressing these challenges. The complexity required for effective use of the Guardian API is substantial and often not fully appreciated.

This is going to be combined with a new client that focuses on a partial "Dryrun SDK" with an end-to-end testcase, I'm going to do my best to highlight particular areas that should be optimised for an API consumption point of view.

A core focus of mine has been minimizing the data transmitted over the network—essentially optimizing API scalability by adhering as closely as possible to REST principles. The ideal is for the API to handle operations on a single asset or a million with equal efficiency, avoiding N+1 query issues that can degrade performance gradually.

For instance, last year’s integration of ELV credits revealed significant scalability issues; as the system scaled, data handling became increasingly inefficient due to N+1 problems with each new asset or verification approval -- this slowed the system to a halt.

To combat this, we've shifted towards more RESTful practices by using filter blocks. Although this isn't a perfect solution and current invalidation challenges for filter blocks still lead to N+1 issues, it's a step in the right direction.

I am more than willing to join any calls to discuss these points further. My stance is simple: focus on getting the foundational aspects right to ensure the API's functionality and scalability. I'm looking forward to potentially testing this with hundreds of thousands of users representing millions of assets in a simulated environment, and eventually on mainnet, considering it offers more bandwidth than the testnet.

Internally at DOVU we are committed to building middleware systems that will alleviate a lot of this requirement on the Guardian team itself, so tools that are specifically for teams and developers like ourselves, who want to primarily focus on API usage.

@simvalery simvalery merged commit a6737eb into develop May 13, 2024
11 checks passed
@Pyatakov Pyatakov deleted the feature/move-to-fastify branch December 18, 2024 15:10
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.

5 participants