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

Cluster: cluster coworkers update of raw api #1887

Closed
wants to merge 9 commits into from
Closed

Cluster: cluster coworkers update of raw api #1887

wants to merge 9 commits into from

Conversation

aesirteam
Copy link

@aesirteam aesirteam commented Aug 2, 2020

Implementing automatic discovery of coworkers in the origin cluster in the K8S environment.

Principle:

  1. Create a headless service for the origin server through the K8S API.
  2. Create a stateful set for the origin server through the K8S API.
  3. Use K8S DNS to query the headless service and obtain the IP addresses of the origin server pods.
  4. Use the RAW API to update coworkers and achieve elastic scaling for the origin server's horizontal pod autoscaler (HPA).
  5. Utilize a livenessProbe to call a shell script for updating coworkers, ensuring the correct lifecycle of the pods while also maintaining health checks.

TRANS_BY_GPT3

@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2020

Codecov Report

Merging #1887 into develop will decrease coverage by 0.07%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1887      +/-   ##
===========================================
- Coverage    55.84%   55.77%   -0.08%     
===========================================
  Files          121      121              
  Lines        50701    50769      +68     
===========================================
- Hits         28315    28314       -1     
- Misses       22386    22455      +69     
Impacted Files Coverage Δ
trunk/src/app/srs_app_config.cpp 68.08% <0.00%> (-0.20%) ⬇️
trunk/src/app/srs_app_config.hpp 100.00% <ø> (ø)
trunk/src/app/srs_app_coworkers.cpp 0.00% <0.00%> (ø)
trunk/src/app/srs_app_http_api.cpp 0.00% <0.00%> (ø)
trunk/src/app/srs_app_reload.cpp 2.50% <0.00%> (-0.07%) ⬇️
trunk/src/app/srs_app_server.cpp 0.00% <0.00%> (ø)
trunk/src/kernel/srs_kernel_utility.cpp 90.37% <0.00%> (-1.39%) ⬇️
trunk/src/protocol/srs_service_utility.cpp 72.43% <0.00%> (-0.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f62587...efce62d. Read the comment docs.

TRANS_BY_GPT3

@aesirteam aesirteam closed this Aug 2, 2020
@aesirteam aesirteam reopened this Aug 4, 2020
@aesirteam
Copy link
Author

aesirteam commented Aug 4, 2020

K8S Deployment File

k8s-srs-clusters.yaml

TRANS_BY_GPT3

@winlinvip winlinvip self-requested a review August 27, 2021 00:20
@winlinvip winlinvip self-assigned this Aug 27, 2021
@winlinvip winlinvip added this to the SRS 4.0 release milestone Aug 27, 2021
@winlinvip winlinvip changed the title added: cluster coworkers update of raw api Cluster: cluster coworkers update of raw api Oct 22, 2021
@winlinvip
Copy link
Member

winlinvip commented Oct 22, 2021

Thank you very much for submitting this PR and providing a solution to the problem. 👍
Make sure to maintain the markdown structure.

By using the service to discover the origin server and updating the configuration of each origin server through the HTTP RAW API, new instances of the origin server can be discovered. This is a very direct approach and does not rely on other services, which is great.
Make sure to maintain the markdown structure.

The essence of this problem is that when the origin server cluster is scaled, it cannot automatically discover new instances of the origin server because the configuration file of the origin server has fixed IP or domain names. The most direct solution is to dynamically modify the configuration file.
Make sure to maintain the markdown structure.

The problem with this solution lies in the HTTP RAW API, which is very unstable because it requires modifying the configuration and then reloading it. Especially in K8S, configuration files are usually configured and mounted to pods through configMap, and modifying the configMap will automatically trigger a reload.
Make sure to maintain the markdown structure.

The RAW API solution is actually conflicting with the reload configuration solution. RAW requires the configuration to be writable, while configMap is read-only (or it is best not to be written by the program to avoid synchronization issues with multiple writes).
Make sure to maintain the markdown structure.

The best way to scale the origin server cluster is to configure coworkers not with their individual IP addresses, but with the address of a service that manages the origin servers. Please refer to OCM: #1607 (comment).
Make sure to maintain the markdown structure.

TRANS_BY_GPT3

@winlinvip winlinvip closed this Oct 22, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants