Closed gottlike closed 4 years ago
I used Docker to run the following Redis instance:
docker run --rm -d -p 6379:6379/tcp redis:5.0.7-alpine3.11
Okay, I just saw this: https://github.com/stefanwille/crystal-redis#connection-pooling
And after using Redis::PooledClient.new
I can't reproduce the issue anymore :tada:
Maybe you would like to mention this in the readme as a requirement when using web frameworks :sweat_smile:
I built a small web app that's supposed to go in production (first Crystal one, actually) and was stress-testing the backend with wrk.
That's when the backend was breaking down, throwing errors and hanging (but only for the routes where Redis is used). I noticed - among other things - that Redis commands were not in order anymore (e.g. a pipe command would have different responses from what was expected). So to me it looks like an issue regarding concurrency/timing.. maybe something like https://github.com/stefanwille/crystal-redis/issues/2, which @waj had fixed(?) quite a while ago.
Following I will paste code and instructions for reproduction:
shard.yml
init_db.cr
app.cr
Then:
crystal run init_db.cr
crystal run app.cr
wrk
command for stress-testing:wrk -t2 -c20 -d5s http://localhost:1337/
(Maybe needs to be executed a few times, before hitting the issue)After running
wrk
you will get timeouts and 500 responses when running simplecurl http://localhost:1337/
commands.This issue is framework independent - it occured with Raze as well as Kemal. Maybe of interest: I'm using (Ubuntu) Linux.