Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Empty iterables should count towards cache usage. (#9028) | Patrick Cloke | 2021-01-06 | 1 | -1/+1 |
| | |||||
* | Implement and use an @lru_cache decorator (#8595) | Richard van der Hoff | 2020-10-30 | 1 | -47/+188 |
| | | | We don't always need the full power of a DeferredCache. | ||||
* | Optimise CacheDescriptor (#8594) github/release-v1.21.3 release-v1.21.3 | Richard van der Hoff | 2020-10-21 | 1 | -5/+7 |
| | | | don't bother constricting a CacheContext unless we need one. | ||||
* | fix failure case | Richard van der Hoff | 2020-10-21 | 1 | -1/+4 |
| | |||||
* | optimise DeferredCache.set | Richard van der Hoff | 2020-10-21 | 1 | -3/+12 |
| | |||||
* | Push some deferred wrangling down into DeferredCache | Richard van der Hoff | 2020-10-21 | 2 | -34/+55 |
| | |||||
* | Fix 'LruCache' object has no attribute '_on_resize' (#8591) | Richard van der Hoff | 2020-10-19 | 1 | -1/+9 |
| | | | We need to make sure we are readu for the `set_cache_factor` callback. | ||||
* | Add `DeferredCache.get_immediate` method (#8568) | Richard van der Hoff | 2020-10-19 | 1 | -10/+25 |
| | | | | | | | | | | | * Add `DeferredCache.get_immediate` method A bunch of things that are currently calling `DeferredCache.get` are only really interested in the result if it's completed. We can optimise and simplify this case. * Remove unused 'default' parameter to DeferredCache.get() * another get_immediate instance | ||||
* | Replace DeferredCache with LruCache where possible (#8563) | Richard van der Hoff | 2020-10-19 | 1 | -0/+3 |
| | | | Most of these uses don't need a full-blown DeferredCache; LruCache is lighter and more appropriate. | ||||
* | review comments | Richard van der Hoff | 2020-10-16 | 1 | -3/+8 |
| | |||||
* | Apply suggestions from code review | Richard van der Hoff | 2020-10-16 | 1 | -1/+1 |
| | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> | ||||
* | type annotations for LruCache | Richard van der Hoff | 2020-10-16 | 3 | -23/+77 |
| | |||||
* | Make LruCache register its own metrics (#8561) | Richard van der Hoff | 2020-10-16 | 4 | -54/+57 |
| | | | | | rather than have everything that instantiates an LruCache manage metrics separately, have LruCache do it itself. | ||||
* | Enable mypy for synapse.util.caches (#8547) | Richard van der Hoff | 2020-10-15 | 1 | -1/+1 |
| | | | This seemed to entail dragging in a type stub for SortedList. | ||||
* | move DeferredCache into its own module | Richard van der Hoff | 2020-10-14 | 2 | -282/+294 |
| | |||||
* | Rename Cache->DeferredCache | Richard van der Hoff | 2020-10-14 | 1 | -7/+12 |
| | |||||
* | Add some more type annotations to Cache | Richard van der Hoff | 2020-10-14 | 2 | -23/+61 |
| | |||||
* | Add type hints to response cache. (#8507) | Patrick Cloke | 2020-10-09 | 1 | -22/+28 |
| | |||||
* | Use slots in attrs classes where possible (#8296) | Patrick Cloke | 2020-09-14 | 1 | -1/+1 |
| | | | | | slots use less memory (and attribute access is faster) while slightly limiting the flexibility of the class attributes. This focuses on objects which are instantiated "often" and for short periods of time. | ||||
* | Stop sub-classing object (#8249) | Patrick Cloke | 2020-09-04 | 8 | -16/+16 |
| | |||||
* | Fix typing for `@cached` wrapped functions (#8240) | Erik Johnston | 2020-09-03 | 1 | -14/+28 |
| | | | This requires adding a mypy plugin to fiddle with the type signatures a bit. | ||||
* | Remove the unused inlineCallbacks code-paths in the caching code (#8119) | Patrick Cloke | 2020-08-19 | 1 | -46/+8 |
| | |||||
* | Remove unnecessary maybeDeferred calls (#8044) | Patrick Cloke | 2020-08-07 | 1 | -1/+1 |
| | |||||
* | Fix some spelling mistakes / typos. (#7811) | Patrick Cloke | 2020-07-09 | 1 | -1/+1 |
| | |||||
* | Replace all remaining six usage with native Python 3 equivalents (#7704) | Dagfinn Ilmari Mannsåker | 2020-06-16 | 1 | -3/+1 |
| | |||||
* | Replace iteritems/itervalues/iterkeys with native versions. (#7692) | Patrick Cloke | 2020-06-15 | 3 | -10/+4 |
| | |||||
* | Don't apply cache factor to event cache. (#7578) | Erik Johnston | 2020-05-27 | 1 | -0/+4 |
| | | | | This is already correctly done when we instansiate the cache, but wasn't when it got reloaded (which always happens at least once on startup). | ||||
* | remove miscellaneous PY2 code | Richard van der Hoff | 2020-05-15 | 1 | -6/+1 |
| | |||||
* | Allow configuration of Synapse's cache without using synctl or environment ↵ | Amber Brown | 2020-05-11 | 7 | -92/+206 |
| | | | | variables (#6391) | ||||
* | Speed up fetching device lists changes in sync. | Erik Johnston | 2020-05-05 | 1 | -4/+15 |
| | | | | | Currently we copy `users_who_share_room` needlessly about three times, which is expensive when the set is large (which it can easily be). | ||||
* | Extend StreamChangeCache to support multiple entities per stream ID (#7303) | Richard van der Hoff | 2020-04-22 | 1 | -46/+71 |
| | | | | | | | | | | | | | | | | | | | First some background: StreamChangeCache is used to keep track of what "entities" have changed since a given stream ID. So for example, we might use it to keep track of when the last to-device message for a given user was received [1], and hence whether we need to pull any to-device messages from the database on a sync [2]. Now, it turns out that StreamChangeCache didn't support more than one thing being changed at a given stream_id (this was part of the problem with #7206). However, it's entirely valid to send to-device messages to more than one user at a time. As it turns out, this did in fact work, because *some* methods of StreamChangeCache coped ok with having multiple things changing on the same stream ID, and it seems we never actually use the methods which don't work on the stream change caches where we allow multiple changes at the same stream ID. But that feels horribly fragile, hence: let's update StreamChangeCache to properly support this, and add some typing and some more tests while we're at it. [1]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L301 [2]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L47-L51 | ||||
* | On catchup, process each row with its own stream id (#7286) | Richard van der Hoff | 2020-04-20 | 1 | -0/+3 |
| | | | | | | Other parts of the code (such as the StreamChangeCache) assume that there will not be multiple changes with the same stream id. This code was introduced in #7024, and I hope this fixes #7206. | ||||
* | Reduce amount of logging at INFO level. (#6862) | Erik Johnston | 2020-02-06 | 1 | -1/+1 |
| | | | | | | | | A lot of the things we log at INFO are now a bit superfluous, so lets make them DEBUG logs to reduce the amount we log by default. Co-Authored-By: Brendan Abolivier <babolivier@matrix.org> Co-authored-by: Brendan Abolivier <github@brendanabolivier.com> | ||||
* | look up cross-signing keys from the DB in bulk (#6486) | Hubert Chathi | 2019-12-12 | 1 | -1/+1 |
| | |||||
* | Remove SnapshotCache in favour of ResponseCache | Erik Johnston | 2019-12-09 | 1 | -94/+0 |
| | |||||
* | Fix LruCache callback deduplication (#6213) | V02460 | 2019-11-07 | 1 | -11/+37 |
| | |||||
* | Remove usage of deprecated logger.warn method from codebase (#6271) | Andrew Morgan | 2019-10-31 | 1 | -1/+1 |
| | | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated. | ||||
* | Update docstring | Erik Johnston | 2019-10-29 | 1 | -3/+2 |
| | |||||
* | Quick fix to ensure cache descriptors always return deferreds | Erik Johnston | 2019-10-28 | 1 | -2/+2 |
| | |||||
* | Fix up some typechecking (#6150) | Amber Brown | 2019-10-02 | 3 | -4/+25 |
| | | | | | | * type checking fixes * changelog | ||||
* | Retry well-known lookup before expiry. | Erik Johnston | 2019-08-13 | 1 | -3/+5 |
| | | | | | | | | | This gives a bit of a grace period where we can attempt to refetch a remote `well-known`, while still using the cached result if that fails. Hopefully this will make the well-known resolution a bit more torelant of failures, rather than it immediately treating failures as "no result" and caching that for an hour. | ||||
* | Fix some error cases in the caching layer. (#5749) | Richard van der Hoff | 2019-07-25 | 1 | -32/+42 |
| | | | | | | | There was some inconsistent behaviour in the caching layer around how exceptions were handled - particularly synchronously-thrown ones. This seems to be most easily handled by pushing the creation of ObservableDeferreds down from CacheDescriptor to the Cache. | ||||
* | Add a prometheus metric for active cache lookups. (#5750) | Richard van der Hoff | 2019-07-24 | 2 | -2/+33 |
| | | | | | | * Add a prometheus metric for active cache lookups. * changelog | ||||
* | Replace returnValue with return (#5736) | Amber Brown | 2019-07-23 | 2 | -2/+2 |
| | |||||
* | Move logging utilities out of the side drawer of util/ and into logging/ (#5606) | Amber Brown | 2019-07-04 | 2 | -7/+8 |
| | |||||
* | Prevent multiple upgrades on the same room at once (#5051) | Andrew Morgan | 2019-06-25 | 1 | -1/+1 |
| | | | | | | | Closes #4583 Does slightly less than #5045, which prevented a room from being upgraded multiple times, one after another. This PR still allows that, but just prevents two from happening at the same time. Mostly just to mitigate the fact that servers are slow and it can take a moment for the room upgrade to actually complete. We don't want people sending another request to upgrade the room when really they just thought the first didn't go through. | ||||
* | Run Black. (#5482) | Amber Brown | 2019-06-20 | 9 | -81/+109 |
| | |||||
* | Add a caching layer to .well-known responses (#4516) | Richard van der Hoff | 2019-01-30 | 1 | -0/+161 |
| | |||||
* | Make scripts/ and scripts-dev/ pass pyflakes (and the rest of the codebase ↵ | Amber Brown | 2018-10-20 | 1 | -1/+3 |
| | | | | on py3) (#4068) | ||||
* | Correctly match 'dict.pop' api | Erik Johnston | 2018-10-01 | 1 | -3/+11 |
| | |||||
* | Don't update eviction metrics on explicit removal | Erik Johnston | 2018-10-01 | 1 | -5/+0 |
| | |||||
* | Merge branch 'rav/fix_expiring_cache_len' into erikj/destination_retry_cache | Richard van der Hoff | 2018-09-26 | 1 | -10/+17 |
|\ | |||||
| * | Log which cache is throwing exceptions | Richard van der Hoff | 2018-09-26 | 1 | -10/+17 |
| | | |||||
| * | Fix ExpiringCache.__len__ to be accurate | Erik Johnston | 2018-09-26 | 1 | -10/+7 |
| | | | | | | | | | | | | | | | | | | | | | | | | It used to try and produce an estimate, which was sometimes negative. This caused metrics to be sad, so lets always just calculate it from scratch. (This appears to have been a longstanding bug, but one which has been made more of a problem by #3932 and #3933). (This was originally done by Erik as part of #3933. I'm cherry-picking it because really it's a fix in its own right) | ||||
* | | Fix ExpiringCache.__len__ to be accurate | Erik Johnston | 2018-09-21 | 1 | -12/+9 |
| | | | | | | | | | | | | It used to try and produce an estimate, which was sometimes negative. This caused metrics to be sad, so lets always just calculate it from scratch. | ||||
* | | Add a five minute cache to get_destination_retry_timings | Erik Johnston | 2018-09-21 | 1 | -0/+13 |
| | | | | | | | | Hopefully helps with #3931 | ||||
* | | Make ExpiringCache slightly more performant | Erik Johnston | 2018-09-21 | 1 | -1/+5 |
|/ | |||||
* | Fix some instances of ExpiringCache not expiring cache items | Erik Johnston | 2018-09-21 | 1 | -1/+0 |
| | | | | | | | | ExpiringCache required that `start()` be called before it would actually start expiring entries. A number of places didn't do that. This PR removes `start` from ExpiringCache, and automatically starts backround reaping process on creation instead. | ||||
* | Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678) | Amber Brown | 2018-08-10 | 3 | -3/+3 |
| | |||||
* | fix invalidation | Richard van der Hoff | 2018-07-27 | 1 | -1/+1 |
| | |||||
* | Rewrite cache list decorator | Richard van der Hoff | 2018-07-27 | 1 | -67/+64 |
| | | | | | Because it was complicated and annoyed me. I suspect this will be more efficient too. | ||||
* | Fix some looping_call calls which were broken in #3604 | Richard van der Hoff | 2018-07-26 | 1 | -1/+1 |
| | | | | | | | | | It turns out that looping_call does check the deferred returned by its callback, and (at least in the case of client_ips), we were relying on this, and I broke it in #3604. Update run_as_background_process to return the deferred, and make sure we return it to clock.looping_call. | ||||
* | Run things as background processes | Richard van der Hoff | 2018-07-18 | 1 | -1/+5 |
| | | | | | | | | This fixes #3518, and ensures that we get useful logs and metrics for lots of things that happen in the background. (There are certainly more things that happen in the background; these are just the common ones I've found running a single-process synapse locally). | ||||
* | Use efficient .intersection | Erik Johnston | 2018-07-17 | 1 | -4/+1 |
| | |||||
* | Fix perf regression in PR #3530 | Erik Johnston | 2018-07-17 | 1 | -1/+6 |
| | | | | | | | | The get_entities_changed function was changed to return all changed entities since the given stream position, rather than only those changed from a given list of entities. This resulted in the function incorrectly returning large numbers of entities that, for example, caused large increases in database usage. | ||||
* | Don't return unknown entities in get_entities_changed | Erik Johnston | 2018-07-13 | 1 | -8/+1 |
| | | | | | | | | The stream cache keeps track of all entities that have changed since a particular stream position, so get_entities_changed does not need to return unknown entites when given a larger stream position. This makes it consistent with the behaviour of has_entity_changed. | ||||
* | Reduce set building in get_entities_changed | Richard van der Hoff | 2018-07-12 | 1 | -8/+12 |
| | | | | | | | | | | | This line shows up as about 5% of cpu time on a synchrotron: not_known_entities = set(entities) - set(self._entity_to_key) Presumably the problem here is that _entity_to_key can be largeish, and building a set for its keys every time this function is called is slow. Here we rewrite the logic to avoid building so many sets. | ||||
* | run isort | Amber Brown | 2018-07-09 | 6 | -26/+23 |
| | |||||
* | Revert "Revert "Try to not use as much CPU in the StreamChangeCache"" (#3454) | Amber Brown | 2018-06-28 | 1 | -2/+4 |
| | |||||
* | Revert "Try to not use as much CPU in the StreamChangeCache" | Matthew Hodgson | 2018-06-26 | 1 | -4/+2 |
| | |||||
* | fixes | Amber Brown | 2018-06-26 | 1 | -2/+2 |
| | |||||
* | fixes | Amber Brown | 2018-06-26 | 1 | -2/+2 |
| | |||||
* | try and make loading items from the cache faster | Amber Brown | 2018-06-26 | 1 | -2/+4 |
| | |||||
* | Disable partial state group caching for wildcard lookups | Richard van der Hoff | 2018-06-22 | 1 | -13/+12 |
| | | | | | | | When _get_state_for_groups is given a wildcard filter, just do a complete lookup. Hopefully this will give us the best of both worlds by not filling up the ram if we only need one or two keys, but also making the cache still work for the federation reader usecase. | ||||
* | Port to sortedcontainers (with tests!) (#3332) | Amber Brown | 2018-06-06 | 1 | -26/+31 |
| | |||||
* | Add hacky cache factor override system | Erik Johnston | 2018-06-04 | 2 | -2/+12 |
| | |||||
* | Consistently use six's iteritems and wrap lazy keys/values in list() if ↵ | Amber Brown | 2018-05-31 | 2 | -3/+5 |
| | | | | they're not meant to be lazy (#3307) | ||||
* | Merge pull request #3281 from NotAFile/py3-six-isinstance | Amber Brown | 2018-05-30 | 1 | -4/+8 |
|\ | | | | | remaining isintance fixes | ||||
| * | remaining isintance fixes | Adrian Tschira | 2018-05-24 | 1 | -4/+8 |
| | | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com> | ||||
* | | add comment about why unreg | Amber Brown | 2018-05-28 | 1 | -0/+2 |
| | | |||||
* | | Merge remote-tracking branch 'origin/develop' into 3218-official-prom | Amber Brown | 2018-05-28 | 1 | -1/+6 |
|\| | |||||
| * | fix py3 intern and remove unnecessary py3 encode | Adrian Tschira | 2018-05-19 | 1 | -1/+6 |
| | | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com> | ||||
* | | cleanup pep8 errors | Amber Brown | 2018-05-22 | 1 | -2/+5 |
| | | |||||
* | | fixes | Amber Brown | 2018-05-22 | 2 | -12/+30 |
| | | |||||
* | | replacing portions | Amber Brown | 2018-05-21 | 6 | -27/+51 |
|/ | |||||
* | Merge pull request #3093 from matrix-org/rav/response_cache_wrap | Richard van der Hoff | 2018-04-20 | 1 | -14/+74 |
|\ | | | | | Refactor ResponseCache usage | ||||
| * | ResponseCache: fix handling of completed results | Richard van der Hoff | 2018-04-13 | 1 | -13/+19 |
| | | | | | | | | | | Turns out that ObservableDeferred.observe doesn't return a deferred if the result is already completed. Fix handling and improve documentation. | ||||
| * | Refactor ResponseCache usage | Richard van der Hoff | 2018-04-12 | 1 | -2/+56 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a `.wrap` method to ResponseCache which wraps up the boilerplate of a (get, set) pair, and then use it throughout the codebase. This will be largely non-functional, but does include the following functional changes: * federation_server.on_context_state_request: drops use of _server_linearizer which looked redundant and could cause incorrect cache misses by yielding between the get and the set. * RoomListHandler.get_remote_public_room_list(): fixes logcontext leaks * the wrap function includes some logging. I'm hoping this won't be too noisy on production. | ||||
* | | Revert "Use sortedcontainers instead of blist" | Richard van der Hoff | 2018-04-13 | 1 | -2/+2 |
|/ | | | | | | | | | | | This reverts commit 9fbe70a7dc3afabfdac176ba1f4be32dd44602aa. It turns out that sortedcontainers.SortedDict is not an exact match for blist.sorteddict; in particular, `popitem()` removes things from the opposite end of the dict. This is trivial to fix, but I want to add some unit tests, and potentially some more thought about it, before we do so. | ||||
* | Merge pull request #3092 from matrix-org/rav/response_cache_metrics | Richard van der Hoff | 2018-04-12 | 1 | -1/+13 |
|\ | | | | | Add metrics for ResponseCache | ||||
| * | Add metrics for ResponseCache | Richard van der Hoff | 2018-04-10 | 1 | -1/+13 |
| | | |||||
* | | Merge pull request #3059 from matrix-org/rav/doc_response_cache | Richard van der Hoff | 2018-04-12 | 1 | -0/+32 |
|\ \ | | | | | | | Document the behaviour of ResponseCache | ||||
| * | | Document the behaviour of ResponseCache | Richard van der Hoff | 2018-04-04 | 1 | -0/+32 |
| | | | | | | | | | | | | | | | | | | it looks like everything that uses ResponseCache expects to have to `make_deferred_yieldable` its results. It's debatable whether that is the best approach, but let's document it for now to avoid further confusion. | ||||
* | | | Use sortedcontainers instead of blist | Vincent Breitmoser | 2018-04-10 | 1 | -2/+2 |
| |/ |/| | | | | | | | | | | | | | This commit drop-in replaces blist with SortedContainers. They are written in pure python so work with pypy, but perform as good as native implementations, at least in a couple benchmarks: http://www.grantjenks.com/docs/sortedcontainers/performance.html | ||||
* | | Fix overzealous cache invalidation | Richard van der Hoff | 2018-04-05 | 1 | -26/+38 |
|/ | | | | | Fixes an issue where a cache invalidation would invalidate *all* pending entries, rather than just the entry that we intended to invalidate. | ||||
* | Add comments | Erik Johnston | 2018-03-19 | 1 | -0/+7 |
| | |||||
* | Fix bug where state cache used lots of memory | Erik Johnston | 2018-03-15 | 2 | -5/+9 |
| | | | | | | | | | The state cache bases its size on the sum of the size of entries. The size of the entry is calculated once on insertion, so it is important that the size of entries does not change. The DictionaryCache modified the entries size, which caused the state cache to incorrectly think it was smaller than it actually was. | ||||
* | report metrics on number of cache evictions | Richard van der Hoff | 2018-02-05 | 3 | -4/+34 |
| | |||||
* | Increase default cache factor size. | Erik Johnston | 2017-07-04 | 1 | -1/+1 |
| | |||||
* | Define CACHE_SIZE_FACTOR once | Erik Johnston | 2017-07-04 | 2 | -9/+2 |
| | |||||
* | Use an ExpiringCache for storing registration sessions | Erik Johnston | 2017-06-29 | 1 | -0/+3 |
| | | | | | This is because pruning them was a significant performance drain on matrix.org | ||||
* | Rewrite conditional | Erik Johnston | 2017-06-09 | 1 | -1/+1 |
| | |||||
* | Fix has_any_entity_changed | Erik Johnston | 2017-06-09 | 1 | -4/+4 |
| | | | | | | | | Occaisonally has_any_entity_changed would throw the error: "Set changed size during iteration" when taking the max of the `sorteddict`. While its uncertain how that happens, its quite inefficient to iterate over the entire dict anyway so we change to using the more traditional `bisect_*` functions. | ||||
* | Add stream change cache | Erik Johnston | 2017-05-31 | 1 | -0/+15 |
| | |||||
* | Pull out if statement from for loop | Erik Johnston | 2017-05-22 | 1 | -6/+14 |
| | |||||
* | Update list cache to handle one arg case | Erik Johnston | 2017-05-22 | 1 | -17/+33 |
| | | | | | | We update the normal cache descriptors to handle caches with a single argument specially so that the key wasn't a 1-tuple. We need to update the cache list to be aware of this. | ||||
* | Make get_state_groups_from_groups faster. | Erik Johnston | 2017-05-17 | 1 | -11/+46 |
| | | | | | | | | | Most of the time was spent copying a dict to filter out sentinel values that indicated that keys did not exist in the dict. The sentinel values were added to ensure that we cached the non-existence of keys. By updating DictionaryCache to keep track of which keys were known to not exist itself we can remove a dictionary copy. | ||||
* | Don't update event cache hit ratio from get_joined_users | Erik Johnston | 2017-05-08 | 1 | -3/+6 |
| | | | | | Otherwise the hit ration of plain get_events gets completely skewed by calls to get_joined_users* functions. | ||||
* | Optimise caches with single key | Erik Johnston | 2017-05-04 | 1 | -9/+33 |
| | |||||
* | Remove DEBUG_CACHES | Erik Johnston | 2017-04-25 | 1 | -2/+0 |
| | |||||
* | Reduce cache size by not storing deferreds | Erik Johnston | 2017-04-25 | 1 | -18/+21 |
| | | | | | | | | | | | | | | | | | | | | Currently the cache descriptors store deferreds rather than raw values, this is a simple way of triggering only one database hit and sharing the result if two callers attempt to get the same value. However, there are a few caches that simply store a mapping from string to string (or int). These caches can have a large number of entries, under the assumption that each entry is small. However, the size of a deferred (specifically the size of ObservableDeferred) is signigicantly larger than that of the raw value, 2kb vs 32b. This PR therefore changes the cache descriptors to store the raw values rather than the deferreds. As a side effect cached storage function now either return a deferred or the actual value, as the cached list decriptor already does. This is fine as we always end up just yield'ing on the returned value eventually, which handles that case correctly. | ||||
* | Only intern ascii strings | Erik Johnston | 2017-04-24 | 1 | -18/+11 |
| | |||||
* | Remove unused instance variable | Erik Johnston | 2017-03-31 | 1 | -4/+0 |
| | |||||
* | Doc new instance variables | Erik Johnston | 2017-03-30 | 1 | -1/+8 |
| | |||||
* | Manually calculate cache key as getcallargs is expensive | Erik Johnston | 2017-03-30 | 1 | -6/+28 |
| | | | | | This is because getcallargs recomputes the getargspec, amongst other things, which we don't need to do as its already been done | ||||
* | Don't convert to deferreds when not necessary | Erik Johnston | 2017-03-30 | 1 | -1/+4 |
| | |||||
* | Fix the logcontext handling in the cache wrappers (#2077) | Richard van der Hoff | 2017-03-30 | 1 | -16/+14 |
| | | | | | | | The cache wrappers had a habit of leaking the logcontext into the reactor while the lookup function was running, and then not restoring it correctly when the lookup function had completed. It's all the fault of `preserve_context_over_{fn,deferred}` which are basically a bit broken. | ||||
* | Fix caching of remote servers' signature keys | Richard van der Hoff | 2017-03-22 | 1 | -63/+72 |
| | | | | | | | | | The `@cached` decorator on `KeyStore._get_server_verify_key` was missing its `num_args` parameter, which meant that it was returning the wrong key for any server which had more than one recorded key. By way of a fix, change the default for `num_args` to be *all* arguments. To implement that, factor out a common base class for `CacheDescriptor` and `CacheListDescriptor`. | ||||
* | Fix assertion to stop transaction queue getting wedged | Richard van der Hoff | 2017-03-15 | 1 | -1/+1 |
| | | | | | | | | ... and update some docstrings to correctly reflect the types being used. get_new_device_msgs_for_remote can return a long under some circumstances, which was being stored in last_device_list_stream_id_by_dest, and was then upsetting things on the next loop. | ||||
* | Add setdefault key to ExpiringCache | Erik Johnston | 2017-03-10 | 1 | -0/+7 |
| | |||||
* | Comment | Erik Johnston | 2017-02-02 | 1 | -1/+4 |
| | |||||
* | Comment | Erik Johnston | 2017-02-02 | 1 | -0/+2 |
| | |||||
* | Update LruCache size estimate on clear | Erik Johnston | 2017-01-18 | 1 | -0/+2 |
| | |||||
* | Measure metrics of string_cache | Erik Johnston | 2017-01-17 | 1 | -3/+8 |
| | |||||
* | Fix typo in return type | Erik Johnston | 2017-01-17 | 1 | -3/+2 |
| | |||||
* | Rename and comment tree_to_leaves_iterator | Erik Johnston | 2017-01-17 | 2 | -5/+8 |
| | |||||
* | Remove needless call to evict() | Erik Johnston | 2017-01-17 | 1 | -1/+0 |
| | |||||
* | Speed up cache size calculation | Erik Johnston | 2017-01-17 | 5 | -46/+128 |
| | | | | | | | | | | | Instead of calculating the size of the cache repeatedly, which can take a long time now that it can use a callback, instead cache the size and update that on insertion and deletion. This requires changing the cache descriptors to have two caches, one for pending deferreds and the other for the actual values. There's no reason to evict from the pending deferreds as they won't take up any more memory. | ||||
* | Use OrderedDict in ExpiringCache | Erik Johnston | 2017-01-16 | 1 | -10/+4 |
| | |||||
* | Add support for 'iterable' to ExpiringCache | Erik Johnston | 2017-01-16 | 1 | -9/+17 |
| | |||||
* | Optionally measure size of cache by sum of length of values | Erik Johnston | 2017-01-13 | 2 | -19/+38 |
| | |||||
* | Change get_pos_of_last_change to return upper bound | Erik Johnston | 2016-09-15 | 1 | -3/+4 |
| | |||||
* | Use stream_change cache to make get_forward_extremeties_for_room cache more ↵ | Erik Johnston | 2016-09-15 | 1 | -0/+5 |
| | | | | effective | ||||
* | Ensure invalidation list does not grow unboundedly | Erik Johnston | 2016-08-19 | 2 | -20/+16 |
| | |||||
* | Rename to on_invalidate | Erik Johnston | 2016-08-19 | 1 | -16/+10 |
| | |||||
* | Make cache_context an explicit option | Erik Johnston | 2016-08-19 | 1 | -8/+27 |
| | |||||
* | Remove lru option | Erik Johnston | 2016-08-19 | 1 | -23/+8 |
| | |||||
* | Add concept of cache contexts | Erik Johnston | 2016-08-19 | 3 | -20/+99 |
| | |||||
* | Cache federation state responses | Erik Johnston | 2016-07-21 | 1 | -2/+11 |
| | |||||
* | Merge branch 'erikj/cache_perf' of github.com:matrix-org/synapse into develop | Erik Johnston | 2016-06-03 | 1 | -10/+25 |
|\ | |||||
| * | Pull out update_results_dict | Erik Johnston | 2016-06-03 | 1 | -8/+7 |
| | | |||||
| * | Small optimisation to CacheListDescriptor | Erik Johnston | 2016-06-03 | 1 | -2/+2 |
| | | |||||
| * | Make cachedList go a bit faster | Erik Johnston | 2016-06-03 | 1 | -10/+34 |
| | | |||||
* | | Change CacheMetrics to be quicker | Erik Johnston | 2016-06-03 | 5 | -25/+44 |
|/ | | | | | | We change it so that each cache has an individual CacheMetric, instead of having one global CacheMetric. This means that when a cache tries to increment a counter it does not need to go through so many indirections. | ||||
* | Deduplicate joins | Erik Johnston | 2016-04-07 | 1 | -1/+1 |
| | |||||
* | Make the cache objects be per instance rather than being global | Mark Haines | 2016-04-06 | 1 | -21/+24 |
| | |||||
* | Fix typo | Mark Haines | 2016-03-24 | 1 | -1/+1 |
| | |||||
* | Deduplicate identical /sync requests | Mark Haines | 2016-03-24 | 1 | -0/+46 |
| | |||||
* | Simplify intern_dict | Erik Johnston | 2016-03-23 | 1 | -17/+10 |
| | |||||
* | Intern all the things | Erik Johnston | 2016-03-23 | 1 | -1/+57 |
| | |||||
* | String intern | Erik Johnston | 2016-03-23 | 1 | -0/+8 |
| | |||||
* | Make LruCache use a dedicated _Node class | Erik Johnston | 2016-03-22 | 1 | -32/+41 |
| | |||||
* | Return list, not generator. | Erik Johnston | 2016-03-14 | 1 | -3/+1 |
| | |||||
* | Use syntax that works on both py2.7 and py3 | Mark Haines | 2016-03-07 | 1 | -1/+1 |
| | |||||
* | Limit stream change cache size too | Erik Johnston | 2016-03-01 | 1 | -1/+5 |
| | |||||
* | Move cache size fiddling to descriptors only. Fix tests | Erik Johnston | 2016-03-01 | 1 | -2/+2 |
| | |||||
* | Add enviroment variable SYNAPSE_CACHE_FACTOR, default it to 0.1 | Erik Johnston | 2016-03-01 | 1 | -0/+6 |
| | |||||
* | Reraise exception | Erik Johnston | 2016-03-01 | 1 | -0/+1 |
| | |||||
* | Correct cache miss detection | Erik Johnston | 2016-03-01 | 1 | -1/+1 |
| | |||||
* | Report size of ExpiringCache | Erik Johnston | 2016-02-23 | 1 | -2/+13 |
| | |||||
* | Change the way we figure out presence updates for small deltas | Erik Johnston | 2016-02-23 | 1 | -0/+16 |
| | |||||
* | Fix up logcontexts | Erik Johnston | 2016-02-08 | 2 | -6/+13 |
| | |||||
* | Fix flake8 warnings for new flake8 | Daniel Wagner-Hall | 2016-02-02 | 3 | -4/+4 |
| | |||||
* | If stream pos is greater then earliest known key and entity hasn't changed, ↵ | Erik Johnston | 2016-01-29 | 1 | -8/+3 |
| | | | | then entity hasn't changed | ||||
* | Prefill stream change caches | Erik Johnston | 2016-01-29 | 1 | -1/+4 |
| | |||||
* | Merge pull request #536 from matrix-org/erikj/sync | Erik Johnston | 2016-01-29 | 1 | -0/+107 |
|\ | | | | | Make /sync "better". | ||||
| * | If the same as the earliest key, assume nothing has changed. | Erik Johnston | 2016-01-28 | 1 | -0/+5 |
| | | |||||
| * | Correctly update _entity_to_key | Erik Johnston | 2016-01-28 | 1 | -4/+5 |
| | | |||||
| * | Fix inequalities | Erik Johnston | 2016-01-28 | 1 | -2/+2 |
| | | |||||
| * | Include cache hits with has_entity_changed | Erik Johnston | 2016-01-28 | 1 | -0/+4 |
| | | |||||
| * | Change name and doc has_entity_changed | Erik Johnston | 2016-01-28 | 1 | -1/+3 |
| | | |||||
| * | Cache tags and account data | Erik Johnston | 2016-01-28 | 2 | -92/+95 |
| | | |||||
| * | Ensure keys to RoomStreamChangeCache are ints | Erik Johnston | 2016-01-28 | 1 | -0/+6 |
| | | |||||
| * | Invalidate caches properly. Remove unused arg | Erik Johnston | 2016-01-28 | 1 | -2/+2 |
| | | |||||
| * | Add cache to room stream | Erik Johnston | 2016-01-27 | 1 | -0/+86 |
| | | |||||
* | | Directly set self.value | Erik Johnston | 2016-01-29 | 1 | -1/+1 |
| | | |||||
* | | Remove spurious self.size | Erik Johnston | 2016-01-29 | 1 | -1/+0 |
| | | |||||
* | | Correctly bookkeep the size of TreeCache | Erik Johnston | 2016-01-29 | 1 | -3/+28 |
| | | |||||
* | | Make TreeCache keep track of its own size. | Erik Johnston | 2016-01-29 | 2 | -6/+10 |
| | | |||||
* | | Reset size on clear | Erik Johnston | 2016-01-29 | 1 | -0/+2 |
|/ | |||||
* | Don't add the member functiopn if we're not using treecache | David Baker | 2016-01-22 | 1 | -1/+4 |
| | |||||
* | docs | David Baker | 2016-01-22 | 1 | -1/+5 |
| | |||||
* | Revert all the bits changing keys of eeverything that used LRUCaches to tuples | David Baker | 2016-01-22 | 2 | -6/+6 |
| | |||||
* | Make LRU cache not default to treecache & add options to use it | David Baker | 2016-01-22 | 2 | -10/+19 |
| | |||||
* | Add __contains__ | David Baker | 2016-01-22 | 1 | -0/+3 |
| | |||||
* | Docs for treecache | David Baker | 2016-01-22 | 1 | -0/+5 |
| | |||||
* | Add invalidate_many here too | David Baker | 2016-01-22 | 1 | -0/+1 |
| | |||||
* | peppate | David Baker | 2016-01-21 | 1 | -2/+2 |
| | |||||
* | Change LRUCache to be tree-based so we can delete subtrees. | David Baker | 2016-01-21 | 4 | -14/+102 |
| | |||||
* | copyrights | Matthew Hodgson | 2016-01-07 | 6 | -6/+6 |
| | |||||
* | Add some docstring explaining the snapshot cache does | Mark Haines | 2015-12-23 | 1 | -1/+23 |
| | |||||
* | Add a unit test for the snapshot cache | Mark Haines | 2015-12-23 | 1 | -2/+2 |
| | |||||
* | Add a cache for initialSync responses that expires after 5 minutes | Mark Haines | 2015-12-22 | 1 | -0/+71 |
| | |||||
* | Don't assume @cachedList function returns keys for everything | Erik Johnston | 2015-08-18 | 1 | -1/+1 |
| | |||||
* | Docstring | Erik Johnston | 2015-08-12 | 1 | -0/+27 |
| | |||||
* | Merge branch 'develop' of github.com:matrix-org/synapse into ↵ | Erik Johnston | 2015-08-12 | 1 | -1/+3 |
| | | | | erikj/dictionary_cache | ||||
* | Wire up the dictionarycache to the metrics | Erik Johnston | 2015-08-12 | 3 | -45/+41 |
| | |||||
* | Move all the caches into their own package, synapse.util.caches | Erik Johnston | 2015-08-11 | 5 | -0/+746 |