New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LOADING Redis is loading the dataset in memory #4624
Comments
Also there is discussion on client lib |
same problem as yours. |
I have created small workaround sh script that helps to wait until Redis fully started, here is the repo https://github.com/Hronom/wait-for-redis This will help till developers fix that. |
Another solution to this could be some blocking command which waits until Redis is ready to serve data. |
@Hronom I believe we can close this issue given this is a by-design feature and not really an issue. Redis enables certain commands while loading the database ( Clients should be responsible for being able to handle |
@filipecosta90 this is defiantly a feature request, the github So please consider this as feature request. In the world of docker this is very needed feature and it 3 years old? 3 years not able to implement solution with open port after load or commands that waits? |
This is indeed by design and a feature request, let's see how painful it is and what we can do to improve. Maybe we can add a config flag that will tell redis not to listen on the socket at startup until after it loaded the persistence file. Another approach could be to postpone most commands (excluding INFO, PING, etc) while loading instead of responding with |
@oranagra I think this should be handled by the client, it's fairly easy to catch this and retry if that's what the app wishes to do. |
We use the Ruby Redis client and this error in not handled properly- i.e. it simply raise the exception:
It is a pain. |
@yossigo It could be that the retry will take minutes to succeed depending on dataset size. Even 10 seconds can be unacceptable in some applications. As I commented in a similar thread: #4561 (comment) "I've been thinking why can't we have a mode where the replica keeps serving stale data while the Full Sync is happening in background. |
@eduardobr You're referring to a specific case here:
In that case, using |
@yossigo I was coincidently testing the behavior of What does it take to move on with this change, and how could I help? Thanks |
In theory, if someone is already willing to get stale reads, and is using Also, truth be told, i don't really like the |
@oranagra @yossigo I started swapping the pointers of whole db array, but later noticed I could use the already tested mechanism of swap db and run it for each db index (will take care of things like maintaining selected db reference). But there are small things I still don't understand and would need help if we want to move on with this, for example, why calling "touchAllWatchedKeysInDb" works for SWAPDB command but crashes some tests if I use it after sync is finished. And if actually I would need to call it at all (we don't do we when restoring the backup in current implementation). Also, the failing test may not be relevant anymore, but I would need help with that. |
up until now, touchAllWatchedKeysInDb was only needed once when we begin the loading, since no commands could be executed during loading.
regarding the crash and the test, i don't now what you're facing, you'll have to debug it. |
PR created: #9323 |
Revisiting this original issue, I think we can solve with little code and no breaking changes for scenarios with more than one replica:
We could have some |
@eduardobr I'm not sure how that solves the original request. Instead of having "-Loading" errors the clients will get stale data for a bit, then later get the loading error later. |
@madolson it solves in the sense that proxies, container orchestrators (and maybe client libraries) can send the client to a replica that is not “-Loading”. When configured with 50% of total replicas, in worst case master will finish syncs in 2 rounds |
@eduardobr I see, I think that is a minor improvement but I'm not sure it solves the original requester's issue, which is that they weren't able to handle the -Loading error. Presumably they could handle the timeout. |
@madolson right, that is not precisely what the author wants, just an alternative to mitigate the problems that -Loading error brings. Original solution of having port closed when doing full sync could confuse other systems because they won't be able to know if redis is even alive. |
As a workaround, I'm using a docker-compose healthcheck: # docker-compose.yml
services:
app:
depends_on:
redis:
condition: service_healthy
redis:
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 1s
timeout: 3s
retries: 5
|
^ This is the way. TIL that the compose spec now allows you to actually wait on other services with healthchecks. https://docs.docker.com/compose/compose-file/#depends_on (Also, apparently |
This is a reference issue from Spring Jira https://jira.spring.io/browse/DATAREDIS-757
This problem not allows Redis to gracefully integrate in environment of microservices.
Several servers have the issue that they open a TCP port before they are actually ready. In contrast, Spring Boot opens a port as soon as it's ready with all initialization and I think that would be a better option for Redis, too, to open a port as soon as all data is loaded.
This helps other application to don't crash with exception:
Please open TCP port when Redis completely ready to serve.
The text was updated successfully, but these errors were encountered: