mob is small Erlang application to stress test HTTP APIs.
With random_gun_request/1
issuing a random Gun request, on the Gun connection it received as its sole argument, and returning the identifier of the stream; this example would hit "localhost"
on port 8000
on five gun connections—continuously, variated slightly in timing, until mob is stopped with mob:stop/0
.
mob:start("localhost", 8000).
mob:add(fun random_gun_request/1, 5).
ConnPid = pid()
The pid of the Gun connection process.
StreamRef = reference()
Identifier of a HTTP response stream for a request. Gun supports HTTP/1.1, HTTP/2 and Websocket.
mob:start(Host, Port) -> ok | {error, Reason}
Host = string()
Port = integer() >= 1
mob:add(StreamFun, Concurrency) -> [startchild_ret()]
StreamFun = fun(ConnPid) -> StreamRef
Concurrency = integer() >= 1