Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Remove `keylen` from `LruCache`. (#9993) | Richard van der Hoff | 2021-05-24 | 1 | -1/+0 |
| | | | | | | | `keylen` seems to be a thing that is frequently incorrectly set, and we don't really need it. The only time it was used was to figure out if we had removed a subtree in `del_multi`, which we can do better by changing `TreeCache.pop` to return a different type (`TreeCacheNode`). Commits should be independently reviewable. | ||||
* | Minor `@cachedList` enhancements (#9975) | Richard van der Hoff | 2021-05-14 | 1 | -6/+8 |
| | | | | | | - use a tuple rather than a list for the iterable that is passed into the wrapped function, for performance - test that we can pass an iterable and that keys are correctly deduped. | ||||
* | Remove redundant "coding: utf-8" lines (#9786) | Jonathan de Jong | 2021-04-14 | 1 | -1/+0 |
| | | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>` | ||||
* | Update black, and run auto formatting over the codebase (#9381) | Eric Eastwood | 2021-02-16 | 1 | -5/+12 |
| | | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version | ||||
* | 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. | ||||
* | Push some deferred wrangling down into DeferredCache | Richard van der Hoff | 2020-10-21 | 1 | -25/+7 |
| | |||||
* | move DeferredCache into its own module | Richard van der Hoff | 2020-10-14 | 1 | -282/+2 |
| | |||||
* | 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 | 1 | -22/+59 |
| | |||||
* | Stop sub-classing object (#8249) | Patrick Cloke | 2020-09-04 | 1 | -4/+4 |
| | |||||
* | 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 iteritems/itervalues/iterkeys with native versions. (#7692) | Patrick Cloke | 2020-06-15 | 1 | -3/+1 |
| | |||||
* | Allow configuration of Synapse's cache without using synctl or environment ↵ | Amber Brown | 2020-05-11 | 1 | -6/+30 |
| | | | | variables (#6391) | ||||
* | look up cross-signing keys from the DB in bulk (#6486) | Hubert Chathi | 2019-12-12 | 1 | -1/+1 |
| | |||||
* | Fix LruCache callback deduplication (#6213) | V02460 | 2019-11-07 | 1 | -11/+37 |
| | |||||
* | 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 | 1 | -2/+20 |
| | | | | | | * type checking fixes * changelog | ||||
* | 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 | 1 | -1/+17 |
| | | | | | | * Add a prometheus metric for active cache lookups. * changelog | ||||
* | Replace returnValue with return (#5736) | Amber Brown | 2019-07-23 | 1 | -1/+1 |
| | |||||
* | Move logging utilities out of the side drawer of util/ and into logging/ (#5606) | Amber Brown | 2019-07-04 | 1 | -5/+6 |
| | |||||
* | Run Black. (#5482) | Amber Brown | 2019-06-20 | 1 | -47/+53 |
| | |||||
* | Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678) | Amber Brown | 2018-08-10 | 1 | -1/+1 |
| | |||||
* | 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. | ||||
* | run isort | Amber Brown | 2018-07-09 | 1 | -12/+10 |
| | |||||
* | Add hacky cache factor override system | Erik Johnston | 2018-06-04 | 1 | -2/+2 |
| | |||||
* | Consistently use six's iteritems and wrap lazy keys/values in list() if ↵ | Amber Brown | 2018-05-31 | 1 | -1/+1 |
| | | | | 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> | ||||
* | | fixes | Amber Brown | 2018-05-22 | 1 | -1/+1 |
| | | |||||
* | | replacing portions | Amber Brown | 2018-05-21 | 1 | -1/+1 |
|/ | |||||
* | 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. | ||||
* | report metrics on number of cache evictions | Richard van der Hoff | 2018-02-05 | 1 | -0/+4 |
| | |||||
* | Define CACHE_SIZE_FACTOR once | Erik Johnston | 2017-07-04 | 1 | -4/+1 |
| | |||||
* | 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. | ||||
* | 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 |
| | |||||
* | 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. | ||||
* | 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`. | ||||
* | Comment | Erik Johnston | 2017-02-02 | 1 | -1/+4 |
| | |||||
* | Comment | Erik Johnston | 2017-02-02 | 1 | -0/+2 |
| | |||||
* | 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 | 1 | -2/+2 |
| | |||||
* | Speed up cache size calculation | Erik Johnston | 2017-01-17 | 1 | -23/+74 |
| | | | | | | | | | | | 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. | ||||
* | Optionally measure size of cache by sum of length of values | Erik Johnston | 2017-01-13 | 1 | -5/+20 |
| | |||||
* | Ensure invalidation list does not grow unboundedly | Erik Johnston | 2016-08-19 | 1 | -12/+8 |
| | |||||
* | 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 | 1 | -13/+64 |
| | |||||
* | 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 | 1 | -4/+13 |
|/ | | | | | | 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. | ||||
* | Make the cache objects be per instance rather than being global | Mark Haines | 2016-04-06 | 1 | -21/+24 |
| | |||||
* | 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 |
| | |||||
* | Fix up logcontexts | Erik Johnston | 2016-02-08 | 1 | -5/+11 |
| | |||||
* | Fix flake8 warnings for new flake8 | Daniel Wagner-Hall | 2016-02-02 | 1 | -2/+2 |
| | |||||
* | Make LRU cache not default to treecache & add options to use it | David Baker | 2016-01-22 | 1 | -6/+14 |
| | |||||
* | Add invalidate_many here too | David Baker | 2016-01-22 | 1 | -0/+1 |
| | |||||
* | Change LRUCache to be tree-based so we can delete subtrees. | David Baker | 2016-01-21 | 1 | -1/+10 |
| | |||||
* | copyrights | Matthew Hodgson | 2016-01-07 | 1 | -1/+1 |
| | |||||
* | 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 | 1 | -14/+3 |
| | |||||
* | Move all the caches into their own package, synapse.util.caches | Erik Johnston | 2015-08-11 | 1 | -0/+359 |