Skip to content

improve speed #41

@alexkli

Description

@alexkli

Optimize overall speed through parallelization, smarter ordering and other means:

  1. faster start to debug ready
  2. faster shutdown => this is critical for VS code debug stop which only gets very minimal time

Specific improvements:

  • startup: avoid reading namespace list if not in wskprops, use from initial action GET

  • startup: create backup action in parallel when debugger is already ready (this takes a lot of time for larger actions, depending on the openwhisk server, 1-10 sec), but has some risks if wskdebug gets killed quickly after being ready

  • startup: parallelize container start and action code GET, this can save ~0.5 to 1 seconds (startup time of container, assuming that's slower than fetching the action code)

  • startup: find ways to make agent installation faster (zip?), currently at 0.5 to 0.6 seconds for concurrency agent

    • unfortunately openhiwsk REST API does not support gzip encoding for header
    • unfortunately zipping it does not seem to be faster, even though 2 KB zipped vs. 4 KB js sources for agent-concurrency.js
  • startup: move docker info check at start (OpenWhiskInvoker.checkIfAvailable()) out of critical path (saves 100-200ms)

  • shutdown: keep action code in memory and use that on restore instead of reading it again from the backup action with another slow request (can be multiple seconds for larger actions, 4 sec for 1 MB)

  • shutdown: 1. restore action, 2. stop container, 3. remove helper actions (more of a robustness improvement) not necessary since below was done

  • shutdown: consider leaving helper actions behind to avoid delete cost??? (2-4 sec)
    for a ~1MB zip action:

     Shutting down...
     wskdebug restore: restored action with original (move step 2) +4s
     wskdebug restore: deleted backup copy (move step 3) +3s
     wskdebug restore: ensured removal of action worker-zip_wskdebug_invoked +355ms
     wskdebug restore: ensured removal of action worker-zip_wskdebug_completed +373ms
     wskdebug stopped container: wskdebug-worker-zip-1586825522274 +329ms
     wskdebug stopped source file watching +0ms
     Done (shutdown took 8.3s)
    

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions