rpc: optimize DescribeGraph by caching the response

Unfortunately, we can't use the graph cache directly here as it doesn't
include all the information we need, since it only includes the minimal
amount of information needed for path finding.

Instead, we use a simple mutex guarded cache that evicts itself after a
certain interval. The default is set small enough that most users
shouldn't really notice. We also provide a way to disable the cache, and
also disable the cache in the itests.

Fixes https://github.com/lightningnetwork/lnd/issues/1232
This commit is contained in:
Olaoluwa Osuntokun committed 2021-11-04 15:30:31 -07:00
1 parent 79406696ad
commit 67e18e6089
4 files changed
+59 -1

No files matched your search

+4
View File
@@ -1088,6 +1088,10 @@ litecoin.node=ltcd
; roughly 2Kb. (default: 20000)
; caches.channel-cache-size=9000000
; The duration that the response to DescribeGraph should be cached for. Setting
; the value to zero disables the cache. (default: 1m)
; caches.rpc-graph-cache-duration=10m
[protocol]