Open sdmcallister opened 1 week ago
Interesting.
MDB_READERS_FULL means the maximum number of simultaneous accesses has been exceeded. By default this is 126, I believe.
I do believe mummy has a new thread for every ongoing request, and I'm not sure exactly when they are cleaned up. So it's possible you could go above that.
I currently don't expose this. I will change this, in the mean time you can work around like so:
import mummy, mummy/routers
import limdb, lmdb
let db = initDatabase("myDirectory")
discard envSetMaxreaders(db.env, 10000)
db["foo"] = "bar"
proc indexHandler(request: Request) =
var headers: HttpHeaders
headers["Content-Type"] = "text/plain"
var f = db["foo"]
request.respond(200, headers, "Hello, World! " & f)
var router: Router
router.get("/", indexHandler)
let server = newServer(router)
echo "Serving on http://localhost:8080"
server.serve(Port(8080))
Then hit it, here it's 5000 requests, 1200 at once:
for i in {1..5000}; do
echo "url = \"http://localhost:8080\""
done > urls.txt
curl --parallel --parallel-immediate --parallel-max 1200 --config urls.txt
Works fine.
I have the following code which attempts to use limdb with mummy:
When I spam the refresh 50+ times eventually I get: