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

Various fixes and improvements #3211

Merged
merged 7 commits into from
Nov 22, 2024
Merged

Conversation

stefannica
Copy link
Contributor

@stefannica stefannica commented Nov 21, 2024

Describe changes

This is a bundle of bug fixes and improvements that were collected during the load tests I have been performing on the ZenML server.

  1. adding a new authorized API endpoint, GET /ap1/v1/load-info, that can be called to fetch some rudimentary information about the current state of the server: how many threads are currently running and how many database connections are established, used or in overflow, in the following format:
{
  "threads": 6,
  "db_connections_total": 13,
  "db_connections_active": 7,
  "db_connections_overflow": 5
}
  1. some Kubernetes orchestrator improvements:
  • using a role binding instead of a cluster role binding when creating the service account used to run pipelines, because a role binding is less intrusive (only grants permissions in one namespace), whereas the cluster role grants permissions across the entire cluster
  • setting some default CPU and memory resource requests for the orchestrator and step pods. It is recommended to have memory resource requests defined for pods, otherwise the Kubernetes scheduler can place them all on the same node where they can blow up and affect other pods or even take down the entire node itself (which is what I observed during my tests). 400 MiB is the minimum memory use for these pods.
  1. catching urllib3.HTTPError when verifying the Kubernetes service connector credentials helps report better errors to the client in case of connection errors (e.g. missing or invalid certificates)

  2. set _warn_on_response_updates to False on the ServiceConnectorResponse removes some pesky and very verbose warnings that show up in the server logs because the type field is intentionally overwritten in transit.

  3. makes some Helm chart fixes and improvements

  • setting the zenml.database.poolSize and zenml.database.maxOverflow values is currently breaking the deployment, because these values are integer and not processed properly in the Helm chart secret definition
  • with this opportunity, I created a special template section for all ZENML_STORE_* environment variables instead of setting them individually all over the place, just like we do with server settings and secret store settings.
  1. updated all our middlewares to be better behaved and catch all exceptions that the next middleware called with call_next might throw and return a response, instead of letting the exception slip. This is a recommendation that came up during load testing, as some of these errors were polluting the logs without revealing the real source of the problem.

  2. this PR contains some fixes and improvements for the database backup/restore functionality

  • when extracting table information from the database during the backup, ordering rows by anything other than their index is extremely slow with larger tables. E.g. fetching 50 pipeline metadata rows sorted by created date takes 50 seconds when that table has around 80k rows. For this reason, we always sort by the index columns (with the exception below)
  • similarly, for self-referencing tables (step runs), during backup we had to sort the rows using their created timestamp, to avoid breaking the foreign key constraint later on when the database dump is restored. This is now replaced with a different strategy: we detect which tables have self-references and then we simply disable the constraint checks during the database restore operation only for these tables.
  • increased batch size from 50 rows to 100 rows to speed up the backup
  1. boost server availability during Kubernetes rolling updates: done simply by making the server pod wait a bit before receiving the SIGTERM signal. This completely elliminates HTTP 503 errors received by clients during rolling updates !!!

  2. make the ZenML client more robust by retrying on various status codes and read errors.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • If my changes require changes to the dashboard, these changes are communicated/requested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

Copy link
Contributor

coderabbitai bot commented Nov 21, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added internal To filter out internal PRs and issues bug Something isn't working labels Nov 21, 2024
@stefannica stefannica requested a review from schustmi November 22, 2024 12:45
@stefannica stefannica merged commit c58f97d into develop Nov 22, 2024
67 checks passed
@stefannica stefannica deleted the bug/various-fixes-and-improvements branch November 22, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal To filter out internal PRs and issues run-slow-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants