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

Split Sync statuses to smaller objects in etcd #542

Merged
merged 11 commits into from
Mar 16, 2022

Conversation

samutamm
Copy link
Contributor

Close #541 .

Change periodically (every 5s) called StatusSyncController.handleStatus.

  • save each status to cluster in individual etcd transaction
  • For TrafficController and RawconfigSyncController, split the large status data structure to smaller items so that each HTTPServer object and each HTTPPipeline object has unique key "${kind}-${specName}" in etcd.

Adapt pkg/api/cluster.go to these changes:

  • egctl object status list does not require changes
  • egctl object status get ${httpPipelineName|httpServerName} uses _getStatusObjectFromTrafficController --> adapt this function to read new status data from etcd

@samutamm samutamm changed the title Experiment smaller statuses Split Sync statuses to smaller objects in etcd Mar 14, 2022
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2022

Codecov Report

Merging #542 (f5415a4) into main (8649d00) will decrease coverage by 1.82%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #542      +/-   ##
==========================================
- Coverage   80.56%   78.74%   -1.83%     
==========================================
  Files          88       94       +6     
  Lines       10123    10814     +691     
==========================================
+ Hits         8156     8515     +359     
- Misses       1514     1814     +300     
- Partials      453      485      +32     
Impacted Files Coverage Δ
pkg/cluster/layout.go 85.00% <0.00%> (-4.48%) ⬇️
pkg/object/httpserver/spec.go 7.14% <0.00%> (ø)
pkg/object/httpserver/context.go 100.00% <0.00%> (ø)
pkg/object/httpserver/cache.go 76.47% <0.00%> (ø)
pkg/object/httpserver/mux.go 63.24% <0.00%> (ø)
pkg/object/httpserver/httpserver.go 66.66% <0.00%> (ø)
pkg/object/httpserver/runtime.go 42.59% <0.00%> (ø)
pkg/filter/proxy/proxy.go 80.10% <0.00%> (+1.45%) ⬆️

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 36480f3...f5415a4. Read the comment docs.

@samutamm
Copy link
Contributor Author

samutamm commented Mar 15, 2022

Here's a memory usage of the same scenario as described in issues #413 and #541 :

easegress_73c72bd_memory_consumption_VS_main

The memory usage is captured by running free -s 2 that outputs memory usage every 2 seconds. The two tests have exactly same code, but the difference is that for the orange one has an extra process that runs egctl object update -f 'path/to/pipelines' every 5 minutes. The two tests were run in different VMs that might also differ slightly. However there was no more the issue of growing memory usage during first 1h 40 minutes of execution.

Here's another view of the same data, for 6 hours of execution and with additional change that pipelines are saved to etcd in groups of 20:
easegress_73c72bd_memory_consumption_VS_main

Summary

This graph shows that the PR helps to fix the memory leak in the main branch (graphs in the left, blue line)

@samutamm samutamm requested a review from localvar March 16, 2022 01:55
@samutamm samutamm requested a review from localvar March 16, 2022 06:02
pkg/option/option.go Outdated Show resolved Hide resolved
@samutamm samutamm requested a review from xxx7xxxx March 16, 2022 09:11
@xxx7xxxx xxx7xxxx merged commit 0313d7c into easegress-io:main Mar 16, 2022
samutamm pushed a commit to samutamm/easegress that referenced this pull request Mar 17, 2022
* split traffic controller to smaller messages (hack)

* fix type conversion

* split both trafficcontroller and rawconfigtrafficcontroller statuses

* include object name to key

* fix typo

* fix egctl object status get

* address code review

* group status updates to transactions of 20 update

* make status update max batch size configurable

* address review: put also the rest to cluster

* Update pkg/option/option.go

Co-authored-by: Yun Long <[email protected]>

Co-authored-by: Yun Long <[email protected]>
localvar pushed a commit that referenced this pull request Mar 29, 2022
* split traffic controller to smaller messages (hack)

* fix type conversion

* split both trafficcontroller and rawconfigtrafficcontroller statuses

* include object name to key

* fix typo

* fix egctl object status get

* address code review

* group status updates to transactions of 20 update

* make status update max batch size configurable

* address review: put also the rest to cluster

* Update pkg/option/option.go

Co-authored-by: Yun Long <[email protected]>

Co-authored-by: Yun Long <[email protected]>
@samutamm samutamm deleted the experiment-smaller-statuses branch April 6, 2022 09:22
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.

Reduce ETCD memory usage when having large number of HTTPPipelines
5 participants