Closed waans11 closed 6 years ago
The implementation can be divided into several steps.
a. Only cache the query result at the city level just like we do cache the city polygons. A simple naive pre-fetch policy can be adjusted at this step to ease the testing of the feature (maybe 150% size of the original request region). The replacement policy can be also simple. When the query keyword or the time range is changed, regard it as a new query and empty the cache store. b. Extend the cache feature to support all level (state, county and city) caching. d. Modify the current Middle-ware to report the city level result at any time so that the caching effect can be maximized. e. The result of multiple queries can be cached at this step. Also, a more sophisticated pre-fetch and replacement policy can be built and applied.
Good summary. Also after each step, let's merge the code to the master and push it to the live system to see the immediate improvement.
Design for caching the result of a query:
It looks goo.d Two minor comments: For 2. There need to be three variables? keyword, timestamp_start, and timestamp_end For 7. It would be faster if we only send the city IDs that were not in the cache to the middleware instead of sending the entire query request.
Updated cache design:
Looks very nice!
Well designed!
PR #406
In addition to the city polygon caching, it would be nice to cache the result of a query so that the front-end doesn't need to communicate with the Cloudberry everytime the current user changes a region. The following things need to be done:
1) Let the middleware send the city level result at any time 2) Let the frontend cache the above result and uses it whenever a user changes a region. 3) Prefetching + Replacement policy adjustment