-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental implementation of a reference counted
file.close
method
The main issue with this implementation is that as k6 does not yet support opening files in the VU context, the ref count for a given file will never reach zero as the VU 0 (init context) holds one reference until the end of the test. The whole idea behind reference counted closing was that in a context with multiple scenarios, once all the instances of a file were explicitly closed by the user, we would be able to release the memory, regardless of what over workloads might be happening next.
- Loading branch information
Showing
5 changed files
with
115 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { open } from "k6/experimental/fs"; | ||
import { sleep } from "k6"; | ||
|
||
export const options = { | ||
vus: 10, | ||
iterations: 10, | ||
}; | ||
|
||
let file; | ||
(async function () { | ||
file = await open("bonjour.txt"); | ||
})(); | ||
|
||
export default async function () { | ||
file.close(); | ||
sleep(10); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters