Getting [ioredis] Unhandled error event: ReplyError: ERR max number of clients reached
Any ideas why?
Solution:Jump to solution
youre trying to exceed the max clients allowable, this is a limitation of redis itself and not due to anything railway related.
make sure to close connections when youre done with them.
maybe look into how you could go about using pooling instead of a new client for every request....
25 Replies
Project ID:
N/A
can i see your connection constructor please?
and we consume something like this
@Brody
no need for the ping please
here is the prod endpoint breaking, aka ~ millions of request broke from yesterday night
https://api.hey.xyz/preference/getPreferences?id=0x01b69c
it works fine with local redis
i mean where you testing millions of requests locally too haha
but what version of redis are you using locally?
its 7.2.3 on local
im not testing millions of req locally, but for like a week its fine on railway it broke suddenly even we didnt push any changes
are you using a depricated redis plugin or a redis service on railway?
no, not using any plugins
its raw redis provided by railway
imo its not with the code, i see same error on medis ui too
not quite what i asked, but i understand the plugin word i used can cause misinterpretation, so let me rephrase.
does your redis database have a volume?
yup yup lemme grab screenshot
this is the max client count
Solution
youre trying to exceed the max clients allowable, this is a limitation of redis itself and not due to anything railway related.
make sure to close connections when youre done with them.
maybe look into how you could go about using pooling instead of a new client for every request.
lemme check how to do that with ioredis
side question, are you making sure to use the private url for redis?
i do see the family:6 but im just making sure
yes on railway project
yes without family 6 private will not work
indeed
cuz railway handles with ipv6
oh yes im no stranger to telling users to set family:6
i usually tell them to set family:0 instead of 6 though, since thats both ipv6 and ipv4