Description
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?
Activity