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

[New Scheduler] Add container counter #5072

Merged
merged 3 commits into from
Mar 11, 2021

Conversation

jiangpengcheng
Copy link
Contributor

Get container count from ETCD when related data get updated in ETCD

Description

It watchs ETCD data changes using WatcherService implemented in #5069, when any new container data under specified namespace is inserted/removed to/from ETCD, it will get count of containers for the namespace by querying ETCD

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.

Get container count from ETCD when related data get updated in ETCD
private var waitingForCountKeys = Set.empty[String]

override def receive: Receive = {
case operation: WatchEndpointOperation if operation.isPrefix =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to avoid updating existingContainerNumByNamespace/inProgressContainerNumByNamespace in multi threads, it will only query and update existingContainerNumByNamespace/inProgressContainerNumByNamespace at one time, during querying and updating, incoming watch events will wait in a set

ec: ExecutionContext,
logging: Logging): ContainerCounter = {
instances
.getOrElseUpdate(namespace, new ContainerCounter(namespace, etcdClient, watcherService))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the Counter are shared among queues which under same namespace, to reduce the query burden against etcd

@codecov-io
Copy link

codecov-io commented Mar 1, 2021

Codecov Report

Merging #5072 (c99d1a7) into master (d8cf172) will decrease coverage by 6.77%.
The diff coverage is 84.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5072      +/-   ##
==========================================
- Coverage   81.81%   75.04%   -6.78%     
==========================================
  Files         204      205       +1     
  Lines        9950     9988      +38     
  Branches      447      453       +6     
==========================================
- Hits         8141     7495     -646     
- Misses       1809     2493     +684     
Impacted Files Coverage Δ
...nwhisk/core/scheduler/queue/ContainerCounter.scala 84.21% <84.21%> (ø)
...core/database/cosmosdb/RxObservableImplicits.scala 0.00% <0.00%> (-100.00%) ⬇️
...ore/database/cosmosdb/cache/CacheInvalidator.scala 0.00% <0.00%> (-100.00%) ⬇️
...e/database/cosmosdb/cache/ChangeFeedConsumer.scala 0.00% <0.00%> (-100.00%) ⬇️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0.00% <0.00%> (-95.48%) ⬇️
...sk/core/database/cosmosdb/CosmosDBViewMapper.scala 0.00% <0.00%> (-93.90%) ⬇️
...tabase/cosmosdb/cache/CacheInvalidatorConfig.scala 0.00% <0.00%> (-92.31%) ⬇️
...enwhisk/connector/kafka/KamonMetricsReporter.scala 0.00% <0.00%> (-83.34%) ⬇️
...e/database/cosmosdb/cache/KafkaEventProducer.scala 0.00% <0.00%> (-78.58%) ⬇️
...whisk/core/database/cosmosdb/CosmosDBSupport.scala 0.00% <0.00%> (-74.08%) ⬇️
... and 17 more

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 d8cf172...c99d1a7. Read the comment docs.

@style95 style95 merged commit f9e469e into apache:master Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants