Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

proposal: re-design startup lifecycle #744

Open
seeflood opened this issue Jul 28, 2022 · 4 comments
Open

proposal: re-design startup lifecycle #744

seeflood opened this issue Jul 28, 2022 · 4 comments
Labels
help wanted Extra attention is needed
Milestone

Comments

@seeflood
Copy link
Member

seeflood commented Jul 28, 2022

What would you like to be added:
Re-design startup lifecycle.

Why is this needed:
Currently the startup sequence is:

  1. app start. Run a grpc server waiting for sidecar to call back
  2. sidecar ready (and then call back to apps, or wait for apps to poll)
  3. app ready to serve/send requests

That's complex and need sofaboot support.

@seeflood
Copy link
Member Author

seeflood commented Jul 28, 2022

Solution A. Busy waiting

  1. Let them start concurrently
    image

  2. Sidecar loops calling the ListTopicSubscriptions API until it success:
    image

  3. The APP should loop heath checking the sidecar until it success:
    image

  4. After the sidecar is ready, the app begin to

@seeflood seeflood changed the title Re-design startup lifecycle proposal: re-design startup lifecycle Jul 28, 2022
@seeflood seeflood added the help wanted Extra attention is needed label Jul 29, 2022
@seeflood seeflood added this to the v0.5 milestone Jul 29, 2022
@seeflood
Copy link
Member Author

seeflood commented Aug 3, 2022

similar issue: dapr/dapr#2918

@seeflood
Copy link
Member Author

seeflood commented Aug 8, 2022

Solution B. Remove circular dependencies !

Circular dependencies are EVIL and we should remove them.

  • Start concurrently

  • The app waits for the sidecar to be ready
    We can implement it in the framework (for example, in the SOFA-Boot) , or using a prestart script in K8s yaml.

  • Remove ListTopicSubscriptions because it's evil and leads to circular dependencies :)

  • Add an API in sidecar for the app to push its manifest, including the topics they want to subscribe.
    image

For more details of this API, see #500 (comment)

@seeflood
Copy link
Member Author

seeflood commented Aug 10, 2022

I had an trouble when implementing solution A:
All API plugins need the callback connection to do Init and gRPC server won't start until they are all inited.
So it's hard to refactor the lifecycle and loop calling back in a separate goroutine
image

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant