Comments (1)
As per the scripting API documentation, the init
function takes a parameter args
, an array whose values are populated by arguments provided to the wrk binary after --
, e.g.
$ wrk -t1 -c1 -d10 -R10 -s /tmp/args.lua http://localhost:1337 -- arg1 arg2
Try experimenting using an init function like the following:
function init(args)
for i, v in ipairs(args) do
print(i,v)
end
end
Which, when invoked as listed above, should output the following:
1 arg1
2 arg2
You can also use environment variables, e.g.
$ env foo=1 bar=2 wrk -t1 -c1 -d10 -R10 -s /tmp/args.lua http://localhost:1337
Which can be accessed in Lua using os.getenv()
, e.g.
local environment = {
foo = tonumber(os.getenv("foo")),
bar = tonumber(os.getenv("bar")),
}
from wrk2.
Related Issues (20)
- Run Make without Lua Script
- [question] wrk2 support http2?
- Req/Sec reports nan HOT 1
- Unsupported target architecture - arm64 M1 Mac HOT 4
- wrk2 installation failed on Mac OS Monterey and Apple M1 Max chip HOT 3
- What's the unit of latency used in lua scripting? HOT 1
- Cut off a release?
- How to import hmac to lua script?
- How -R works and why I can't corellate resulting Requests/sec with it? HOT 5
- Web/Desktop Application to load histogram data from wrk2
- How to associate response with request in Lua script
- Are there plans to port the code to the windows platform HOT 3
- more a question than an issue ...
- can not make.
- does wrk2 supports tlsv1.3 over https?
- Question
- wrk2 produces incorrect results HOT 5
- add windows platform support
- Sampling latency
- Cannot build on MacOS Sonoma 14.4.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrk2.