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

refactor(microservices): improve speed of grpc server initialization #13392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yjiq150
Copy link

@yjiq150 yjiq150 commented Apr 3, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

In order to find grpc service descriptors, collectDeepServices function recursively searches whole grpcDefinitions generated by protoLoader, which currently includes all descriptors like namespace, service, and field.

What is the new behavior?

Because field descriptors cannot have namespace as their child, they don't need to be recursively searched. They can distinguished by checking existence of 'format' field and they can be skipped from the search to speed up the process.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

In the project I am working on, proto models are heavily used.
It took more than 3 seconds in M2 MacBook Pro to run collectDeepServices before the modification.
Now it takes around 300ms in the same environment after the modification

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9a0d37e7-42c8-4e54-a3ae-9b3a5c95c083

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 92.125%

Totals Coverage Status
Change from base Build eacd3e56-4bed-4f5e-9bab-412a10335aab: 0.002%
Covered Lines: 6738
Relevant Lines: 7314

💛 - Coveralls

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

3 participants