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

Cache is inconsistent in multi-web-head use cases. #92

Open
ndobromirov opened this Issue Feb 21, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@ndobromirov

ndobromirov commented Feb 21, 2017

Imagine the multi web server application.

There are local APCu and shared Redis cache pools.

The issue is when web 1 deletes a key. It is deleted from it's local and the shared pools. At the same time web 2 and all the rest (if there are any), do not know anything, so they are still hitting successfully their local invalid APCu pools.

I did not find a workaround fir this in the chained adapter.

@Nyholm

This comment has been minimized.

Show comment
Hide comment
@Nyholm

Nyholm Feb 21, 2017

Member

That is an interesting case. I do not think we can solve that in application land.

You could make a cache invalidator service that make sure to invalidate the local cache on all your nodes. But a much more normal approach would be to reduce the cache invalidation time on your local cache.

Im not to sure how to configure the ChainedCachePool for such setup though.

Member

Nyholm commented Feb 21, 2017

That is an interesting case. I do not think we can solve that in application land.

You could make a cache invalidator service that make sure to invalidate the local cache on all your nodes. But a much more normal approach would be to reduce the cache invalidation time on your local cache.

Im not to sure how to configure the ChainedCachePool for such setup though.

@ndobromirov

This comment has been minimized.

Show comment
Hide comment
@ndobromirov

ndobromirov Feb 22, 2017

This one is aiming to solve this use-case.
I do not know how easy would it be to integrate it under php-cache project.

ndobromirov commented Feb 22, 2017

This one is aiming to solve this use-case.
I do not know how easy would it be to integrate it under php-cache project.

@rattrap

This comment has been minimized.

Show comment
Hide comment
@rattrap

rattrap Apr 24, 2018

That's kinda the same problem we're having right now. What we did before trying to use the PSR6 standard was we kept data that changed often for a shorter time in APCu (5 seconds, for example, when we had data like price and stock), and there was a fallback to Memcached where we kept it like 7 days if there was no update on that data and we could also invalidate it easily.

Chain cache is not compatible with this use case and neither is PSR6 (you need multiple ttls per item).

We're glad we're not the only ones having this problem. I'm curious if someone found an elegant solution for this issue.

rattrap commented Apr 24, 2018

That's kinda the same problem we're having right now. What we did before trying to use the PSR6 standard was we kept data that changed often for a shorter time in APCu (5 seconds, for example, when we had data like price and stock), and there was a fallback to Memcached where we kept it like 7 days if there was no update on that data and we could also invalidate it easily.

Chain cache is not compatible with this use case and neither is PSR6 (you need multiple ttls per item).

We're glad we're not the only ones having this problem. I'm curious if someone found an elegant solution for this issue.

@rattrap

This comment has been minimized.

Show comment
Hide comment
@rattrap

rattrap Apr 24, 2018

The only solution I was able to come up with is to reimplement Chain Cache, add TTLs per pool type and make them mandatory but this also fails when you read the data from the cache in your frontend and write it in the backend like we do because when you call the get item method you should have the same TTLs and when you save the data.

rattrap commented Apr 24, 2018

The only solution I was able to come up with is to reimplement Chain Cache, add TTLs per pool type and make them mandatory but this also fails when you read the data from the cache in your frontend and write it in the backend like we do because when you call the get item method you should have the same TTLs and when you save the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment