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

Improve parsing time on big clusters #571

Merged
merged 12 commits into from
Jul 20, 2020
Merged

Improve parsing time on big clusters #571

merged 12 commits into from
Jul 20, 2020

Conversation

jcmoraisjr
Copy link
Owner

@jcmoraisjr jcmoraisjr commented May 2, 2020

Improves the time of object parsing on big k8s clusters - about 1000+ ingress objects which references 1000+ services - using an updatable haproxy model and a object<->model tracking.

The implementation follows this approach:

  • track changes on each relevant object type - currently ingress, service, endpoint, secret, configmap, and also pod if drain-support is used;
  • every object tracks a host and/or backend in the haproxy model;
  • if the object is removed or updated, only the tracked host and/or backend is rebuilt;
  • dynupdate doesn't compare old/cur state anymore, but instead dirty and new host/backend state.

Work in progress:

  • object<->model link tracker
  • tracker tests
  • partial converter parsing
  • converter tests
  • partial haproxy model parsing
  • haproxy model tests
  • dynupdate refactor
  • stronger tracking
  • cache read X notification concurrency
  • track ingress, domains and backends
  • track ingress' secrets
  • track annotation parsing
  • track userlist
  • track pods on drain support mode

@jcmoraisjr jcmoraisjr changed the title WIP: Implement model update WIP: Improve parsing time on big clusters Jun 22, 2020
@jcmoraisjr jcmoraisjr mentioned this pull request Jun 22, 2020
3 tasks
Improves the time of object parsing on big k8s clusters - about 1000+ ingress objects which references 1000+ services - using a updatable haproxy model and a object<->model tracking.

The implementation follows this approach:

* track changes on each relevant object type - currently ingress, service, endpoint, secret, configmap, and also pod if drain-support is used;
* every object tracks a host and/or backend in the haproxy model;
* if the object is removed or updated, only the tracked host and/or backend is rebuilt;
* dynupdate doesn't compare old/cur state anymore, but instead dirty and new host/backend state.

This update has the majority of the job: notification improvement, object<->model tracking and converter changes. Missing dirty/new state in the haproxy model, concurrency improvements, dynupdate refactor and some minor adjusts.
Refactor haproxy types, config, instance and dynupdate to use a single config object instead of the dual old/cur objects. Model updates are made via del/add/commit hosts, backends, tcpservices and userlists. Globals are still being fully parsed when configmap is changed, and cloned when the config is committed.

Dynupdate now uses del/add lists to know what could be changed. Since there isn't update, but instead del/add, both lists are linked using the proxy name and every match act as an old/new state instead. Dynupdate has also evolved to apply all changes that could be dynamically applied, even if it's known a reload must be made. This minimizes outdated info in the case haproxy fails to reload.
@jcmoraisjr jcmoraisjr changed the title WIP: Improve parsing time on big clusters Improve parsing time on big clusters Jul 6, 2020
SyncConfig only need to synchronise changed hosts, so changing to iterate only over them.
A certificate store caches all parsed certificates references on ingress objects. Every time a secret is updated or removed, the crt store need to be synced again.
# Conflicts:
#	pkg/controller/controller.go
#	pkg/controller/listers.go
#	pkg/converters/ingress/ingress.go
#	pkg/converters/ingress/ingress_test.go
@jcmoraisjr jcmoraisjr merged commit 8a95242 into master Jul 20, 2020
@jcmoraisjr jcmoraisjr deleted the jm-model-update branch July 20, 2020 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant