Skip to content

Add Function Cache Refresh If Invoker Is Running Container For Function #5327

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

Merged
merged 4 commits into from
Sep 28, 2022

Conversation

bdoyle0182
Copy link
Contributor

@bdoyle0182 bdoyle0182 commented Sep 27, 2022

Description

This adds a periodic message to the container proxy that will make a request to the function cache to keep the function in the cache. The cache used to store downloaded functions has a keepalive for 5 minutes between accesses before it evicts. The default openwhisk container idleTimeout is 10 minutes. This means if you're using the default, you have a five minute gap between when a function is evicted and the container continues to run where once the container is unpaused it has to redownload the function before serving an activation. This doesn't really make any sense since behavior wise since the warm container already has the data it needs and the function check is mainly just for verifying it hasn't been updated. So this takes re-downloading the function cache off the critical path for an already warm container, but also since the cache is pinged on a 1 minute interval, so less than the cache eviction time; the function should never need to be re-downloaded so long as a container still exists for the function on the invoker.

Heuristically, this makes a noticeable difference to the tp99 cases for functions. Especially functions that are >10mb in size and are infrequently accessed to hit this case.

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Scheduler
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@bdoyle0182 bdoyle0182 requested a review from style95 September 27, 2022 23:07
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2022

Codecov Report

Attention: Patch coverage is 31.25000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 76.35%. Comparing base (625c5f2) to head (36d6663).
Report is 82 commits behind head on master.

Files with missing lines Patch % Lines
...ntainerpool/v2/FunctionPullingContainerProxy.scala 31.25% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5327      +/-   ##
==========================================
- Coverage   81.08%   76.35%   -4.74%     
==========================================
  Files         239      239              
  Lines       14259    14271      +12     
  Branches      575      584       +9     
==========================================
- Hits        11562    10896     -666     
- Misses       2697     3375     +678     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@style95 style95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me.

whenUnhandled {
case Event(PingCache, data: WarmData) =>
val actionId = data.action.fullyQualifiedName(false).toDocId.asDocInfo(data.revision)
get(entityStore, actionId.id, actionId.rev, true).map(_ => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve the performance? to sync the action data from Couchdb with interval time.

@bdoyle0182 bdoyle0182 merged commit 6effb15 into apache:master Sep 28, 2022
msciabarra pushed a commit to nuvolaris/openwhisk that referenced this pull request Nov 23, 2022
…on (apache#5327)

* wip

* wip

* add cache refresh to container proxy

Co-authored-by: Brendan Doyle <[email protected]>
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.

4 participants