Here's a sample program that you can use to duplicate the error I'm getting,
in case you need it. The init just creates some dummy data.
I benchmarked this with: ab -c 100 -n 100000 http://localhost:8080/test
import vibe.d;
void doInit(HttpServerRequest req, HttpServerResponse res)
{
auto redis = new RedisClient();
redis.connect("127.0.0.1", 6379);
string key = "testkey";
for (int i = 0; i < 1000; i++)
{
redis.request("ZADD", cast(ubyte[])key,
cast(ubyte[])to!(string)(i),
cast(ubyte[])to!(string)(i));
}
res.statusCode = HttpStatus.Created;
res.writeBody("");
}
void getTest(HttpServerRequest req, HttpServerResponse res)
{
auto redis = new RedisClient();
redis.connect("127.0.0.1", 6379);
string key = "testkey";
auto items = redis.request("ZREVRANGEBYSCORE",
cast(ubyte[])key,
cast(ubyte[])to!(string)(int.max),
cast(ubyte[])"0");
string[] itemList;
while (items.hasNext)
{
itemList ~= items.next!(string)();
}
res.writeJsonBody(itemList);
}
shared static this()
{
auto router = new UrlRouter;
router.get("/test", &getTest)
.post("/init", &doInit);
auto settings = new HttpServerSettings;
settings.port = 8080;
listenHttp(settings, router);
}
FYI: for some reason, if I pass "localhost" into the redis.connect method, it
doesn't connect to redis. I have to explicitly put 127.0.0.1 in.