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

Run 1000+ VUs: Isolate browser contexts #1112

Closed
8 tasks done
Tracked by #1138
inancgumus opened this issue Nov 27, 2023 · 0 comments
Closed
8 tasks done
Tracked by #1138

Run 1000+ VUs: Isolate browser contexts #1112

inancgumus opened this issue Nov 27, 2023 · 0 comments
Assignees
Labels
feature A new feature internal internal improvements and features optimization performance team/k6browser To distinguish the issue on project boards.

Comments

@inancgumus
Copy link
Member

inancgumus commented Nov 27, 2023

What?

Separate browser contexts to make each iteration focus solely on its pages rather than those created by other iterations.

Why?

While investigating #971 and other relevant issues, it became apparent that the issue wasn't about bug fixing but more about the general workings of the module that stagnated the whole process down to its knees. Here's a solution.

Isolating browser contexts might provide:

  • Efficiency (10X)
  • Better debugging (less log noise)
  • Possibly less deadlocks

More why:

  • Each iteration has a single browser context.
  • However, iterations track the pages of other iterations besides their own. This causes them to deadlock when the browser specs are low and there are many VUs.
  • Isolating browser contexts for each iteration can allow other iterations to deal only with their own pages.
  • By isolating browser contexts, we prevent VUs from tracking pages outside their iterations, reducing timeouts and improving efficiency.

Additional info

On the remote, with 1K iterations, we see that:

  • VUs spend a lot of time tracking the pages of other iterations.
  • Most of their time goes to tracking instead of doing their own work.
  • While they're tracking other iterations, navigations continue, and timeouts occur. One of them is err:timed out .. category=Browser:newPageInContext.-
  • Almost whenever there are a lot of iterations. we can observe this locally, too.

Tasks

Tasks

  1. browser context bug internal optimization performance remote
    inancgumus

Related PR(s)/Issue(s)

#848 ignored the pages created by the browser contexts of other VUs/instances.

There, we found that:

  • Each iteration (so a VU) tracks the pages created by other iterations.
  • Pages aren't confined to their initiating browser context (and VUs), leading to VUs tracking unrelated pages.

Others: #971, #966, #970, #861, #445

Issues will be closed by this issue (possibly 🤞)

#971, #966, #973, and #986.

@inancgumus inancgumus added feature A new feature next Might be eligible for the next planning (not guaranteed!) evaluate labels Nov 27, 2023
@inancgumus inancgumus self-assigned this Nov 27, 2023
@inancgumus inancgumus added the epic label Dec 5, 2023
@inancgumus inancgumus removed the next Might be eligible for the next planning (not guaranteed!) label Dec 13, 2023
@inancgumus inancgumus added the team/k6browser To distinguish the issue on project boards. label Dec 20, 2023
@inancgumus inancgumus added performance internal internal improvements and features and removed evaluate epic labels Feb 21, 2024
inancgumus added a commit to grafana/k6 that referenced this issue Mar 6, 2024
inancgumus added a commit to grafana/k6 that referenced this issue Mar 6, 2024
* Add grafana/xk6-browser#1112

* Rephrase browser 1112 to release notes

Co-authored-by: Ankur <[email protected]>
oleiade pushed a commit to grafana/k6 that referenced this issue Mar 18, 2024
* Add grafana/xk6-browser#1112

* Rephrase browser 1112 to release notes

Co-authored-by: Ankur <[email protected]>
oleiade added a commit to grafana/k6 that referenced this issue Mar 25, 2024
* Add k6 v0.50.0 release notes

* Add changes for the goja refactors in browser

* Update release notes/v0.50.0.md

Co-authored-by: İnanç Gümüş <[email protected]>

* Add browser#1163 to release notes

* Add browser#1205 to release notes (#3584)

* Add 1215 to release notes

* Update release notes/v0.50.0.md

Co-authored-by: İnanç Gümüş <[email protected]>

* Add screenshot upload to release notes

* Update wording for screenshot upload update

* Add browser 1209 to release notes (#3604)

* Add browser 1217 to release notes (#3603)

* Add browser 850 and Go 1.20 PRs to release notes (#3605)

* Add browser 1220 and 1221 to release notes

* Add/browser 1112 to release notes (#3624)

* Add grafana/xk6-browser#1112

* Rephrase browser 1112 to release notes

Co-authored-by: Ankur <[email protected]>

* Add better error pr for browser evaluate APIs

* Add browser testRunId inject prs to release note

* Update the verb

* Add details of browser#1238 to release notes

* Add details of browser#1097 to release notes

* Apply suggestions from code review

Co-authored-by: İnanç Gümüş <[email protected]>

* JWK, options.cloud and some other changelogs

* Link webcrypto JWK import/export to PR

* Add browser#1241 to release notes

* Update the browser#1097 release notes

The API has changed so that it requires working with the experimental
fs module to upload files from the local file system.

* Add browser 986 (#3652)

* Add browser 986

* Update add browser 1246

Co-authored-by: Ankur <[email protected]>

* Add k6/timers stabilization release notes

* Add #3653 to release notes

* Apply suggestions from code review

Co-authored-by: Heitor Tashiro Sergent <[email protected]>

* Add notice for async browser API breaking change

* Apply suggestions from code review

Co-authored-by: İnanç Gümüş <[email protected]>

* Add await explanation on non thenable

* Add release changes top-level summary

* Apply suggestions from code review

Co-authored-by: Mihail Stoykov <[email protected]>

* Remove placeholders

---------

Co-authored-by: ankur22 <[email protected]>
Co-authored-by: İnanç Gümüş <[email protected]>
Co-authored-by: Oleg Bespalov <[email protected]>
Co-authored-by: Mihail Stoykov <[email protected]>
Co-authored-by: Joan López de la Franca Beltran <[email protected]>
Co-authored-by: Heitor Tashiro Sergent <[email protected]>
Co-authored-by: Mihail Stoykov <[email protected]>
@inancgumus inancgumus changed the title Isolate browser contexts between iterations Run 1000+ VUs: Isolate browser contexts between iterations Jul 5, 2024
@inancgumus inancgumus changed the title Run 1000+ VUs: Isolate browser contexts between iterations Run 1000+ VUs: Isolate browser contexts Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature internal internal improvements and features optimization performance team/k6browser To distinguish the issue on project boards.
Projects
None yet
Development

No branches or pull requests

1 participant