Skip to content
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

Slow Cache retrieval #202

Open
CyberHawkJoe opened this issue Mar 1, 2023 · 0 comments
Open

Slow Cache retrieval #202

CyberHawkJoe opened this issue Mar 1, 2023 · 0 comments

Comments

@CyberHawkJoe
Copy link

CyberHawkJoe commented Mar 1, 2023

Hi,

Thanks for the great package, I've recently run into performance issues when caching (specifically cache retrieval) eloquent collections containing models with spatial fields.

I have a table with 100k rows [id, name, location, created_at, updated_at] where the location column is of type Point.
I have a corresponding Eloquent Model using the SpacialTrait with the location field added to the $spatialFields array.

I can retrieve all 100k rows from the DB and return them as an API response via a restful controller and JSON Resource in ~4 seconds on my local dev environment.

If I Cache the resulting collection using the Cache facade so that subsequent requests retrieve the collection from Redis (I've also tried the file cache driver), the initial uncached request returns in a similar amount of time from the DB, subsequent requests take in excess of 30 seconds to return the API response to the client.

If I remove the SpatialTrait or replace the location column with decimal lat/lng columns and return the exact same AIP response without the spatial trait the cache retrieval time drops to ~1 second.

The time taken to retrieve items from the cache seems to be reasonable <=~30k models, after that it seems to increase exponentially.

Has anybody else encountered this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant