Gatling version: 3.14.700
Gatling flavor: TypeScript
Build tool: npm
Context: I’m writing load tests using the TypeScript DSL to simulate front-end interactions with our backend. Some of these interactions involve complex business logic that’s already implemented in our front-end team’s TypeScript SDK.
Challenge: Rather than reimplementing and maintaining duplicate logic in the load tests, I’d like to reuse the existing SDK directly within custom exec steps since I have no need to monitor these specific calls as part of the load test. However, I have concerns about thread safety.
Technical Question: I understand that blocking code in custom exec blocks should be avoided since they execute in a shared thread pool across virtual users. The SDK methods are all defined as async functions in TypeScript.
My question is: How does Gatling’s Scala engine handle TypeScript async/await operations in custom exec steps?
Specifically:
-
Are TypeScript async calls safe to use without blocking other virtual users?
-
How does the JavaScript event loop model translate to the JVM threading model during test execution?
-
Are there any best practices or pitfalls I should be aware of when using async TypeScript SDK calls in custom exec steps?
Use Case Example:
typescript
// Simplified example
exec(async (session) => {
const result = await frontendSDK.complexOperation(session.get('data'));
return session.set('processedData', result);
})
Any insights into the threading model and execution context would be greatly appreciated!
Thanks in advance!