Cache the wd request dispatcher#14493
Conversation
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/browserstack-service
@wdio/cli
@wdio/concise-reporter
@wdio/cucumber-framework
@wdio/config
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/smoke-test-service
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
webdriver
@wdio/webdriver-mock-service
webdriverio
commit: |
christian-bromann
left a comment
There was a problem hiding this comment.
I totally agree that we can be more efficient here. However the current implementation would not allow to have multiple WebDriver sessions with different options as we would cache one dispatcher per process. I wonder if we can store them in a map based on a given session id. Wdyt?
i initially wanted to use a map, but thought each process would only have 1 set of options, defined at test start. So i missed this scenario you mentioned. |
christian-bromann
left a comment
There was a problem hiding this comment.
We should clean up session entries at some point otherwise the map may grow infinitely. One way could be to check if the request is a delete session request and clean up after.
good idea, should i also add unit tests for this change ? |
That would be great, thanks! |
will do so tomorrow after work |
|
@christian-bromann when there are no other change requests, i'd like to rerun the performance tests on the final version with the tests here https://github.com/dragosMC91/wdio-exclude-pattern-bug-highlight/blob/master/test/specs/suite1/validatePerformance.desktop.test.js |
|
Hey dragosMC91 👋 Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. We are looking forward to more contributions from you in the future 🙌 Have a nice day, |
Proposed changes
I noticed that a new agent is created for each individual wd request. Maybe i am missing something but this seems excessive.
I propose using a cached instance of the dispatcher.
I validated the performance improvement for this change via the performance tests referenced in the issue for this fix - #14492
Types of changes
Checklist
Backport Request
//: # (The current
mainbranch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against thev8branch.)v9and doesn't need to be back-ported#XXXXXReviewers: @webdriverio/project-committers