Skip to content

Commit

Permalink
AB testing (#1930)
Browse files Browse the repository at this point in the history
Add AB testing framework:
- Experiments are added by adding a section in router.path-finding config. Each experiment can have different parameters.
- Traffic is randomly split among the different experiments. The size of each experiment is configurable. 0% experiments don't affect traffic but can be triggered manually with the API.
- Metrics are recorded in the audit database
  • Loading branch information
thomash-acinq committed Sep 9, 2021
1 parent 6c546f0 commit 768a745
Show file tree
Hide file tree
Showing 35 changed files with 1,013 additions and 389 deletions.
161 changes: 105 additions & 56 deletions eclair-core/src/main/resources/reference.conf
Expand Up @@ -191,63 +191,112 @@ eclair {
channel-query-chunk-size = 100 // max number of short_channel_ids in query_short_channel_ids *do not change this unless you know what you are doing*
}

// the values below will be used to perform route searching
// The values below will be used to perform route searching
path-finding {
randomize-route-selection = true // when computing a route for a payment we randomize the final selection

max-route-length = 6 // max route length for the 'first pass', if none is found then a second pass is made with no limit
max-cltv = 1008 // max acceptable cltv expiry for the payment (1008 ~ 1 week)
fee-threshold-sat = 21 // if fee is below this value we skip the max-fee-pct check
max-fee-pct = 0.03 // route will be discarded if fee is above this value (in percentage relative to the total payment amount); doesn't apply if fee < fee-threshold-sat

// channel 'weight' is computed with the following formula: (channelFee + hop-cost) * (ratio-base + cltvDelta * ratio-cltv + channelAge * ratio-channel-age + channelCapacity * ratio-channel-capacity)
// the following parameters can be used to ask the router to use heuristics to find i.e: 'cltv-optimized' routes, **the sum of the four ratios must be 1**
ratio-base = 0.0
ratio-cltv = 0.05 // when computing the weight for a channel, consider its CLTV delta in this proportion
ratio-channel-age = 0.4 // when computing the weight for a channel, consider its AGE in this proportion
ratio-channel-capacity = 0.55 // when computing the weight for a channel, consider its CAPACITY in this proportion

// Virtual fee for additional hops
// Corresponds to how much you are willing to pay to get one less hop in the payment path
hop-cost-base-msat = 500
hop-cost-millionths = 200

// Examples:
// To optimize for fees only:
// ratio-base = 1
// ratio-cltv = 0
// ratio-channel-age = 0
// ratio-channel-capacity = 0
// hop-cost-base-msat = 0
// hop-cost-millionths = 0
//
// To optimize for shorter paths:
// ratio-base = 1
// ratio-cltv = 0
// ratio-channel-age = 0
// ratio-channel-capacity = 0
// hop-cost-base-msat = 10000 // High hop cost penalizes strongly longer paths
// hop-cost-millionths = 10000
//
// To optimize for successful payments:
// ratio-base = 0
// ratio-cltv = 0
// ratio-channel-age = 0.5 // Old channels should have less risk of failures
// ratio-channel-capacity = 0.5 // High capacity channels are more likely to have enough liquidity to relay our payment
// hop-cost-base-msat = 1000 // Less hops means less chances of failures
// hop-cost-millionths = 1000
//
// To optimize for fast payments:
// ratio-base = 0.2
// ratio-cltv = 0.5 // In case of failure we want our funds back as fast as possible
// ratio-channel-age = 0.3 // Older channels are more likely to run smoothly
// ratio-channel-capacity = 0
// hop-cost-base-msat = 10000 // Shorter paths should be faster
// hop-cost-millionths = 10000

mpp {
min-amount-satoshis = 15000 // minimum amount sent via partial HTLCs
max-parts = 5 // maximum number of HTLCs sent per payment: increasing this value will impact performance
default {
randomize-route-selection = true // when computing a route for a payment we randomize the final selection

boundaries {
max-route-length = 6 // max route length for the 'first pass', if none is found then a second pass is made with no limit
max-cltv = 1008 // max acceptable cltv expiry for the payment (1008 ~ 1 week)
// the route must have a fee that's below max-fee-flat-sat OR below max-fee-proportional-percent / 100 * total-amount
max-fee-flat-sat = 21
max-fee-proportional-percent = 3 // that's 3%
}

// channel 'weight' is computed with the following formula: (channelFee + hop-cost) * (ratio-base + cltvDelta * ratio-cltv + channelAge * ratio-channel-age + channelCapacity * ratio-channel-capacity)
// the following parameters can be used to ask the router to use heuristics to find i.e: 'cltv-optimized' routes, **the sum of the four ratios must be 1**
ratios {
base = 0.0
cltv = 0.05 // when computing the weight for a channel, consider its CLTV delta in this proportion
channel-age = 0.4 // when computing the weight for a channel, consider its AGE in this proportion
channel-capacity = 0.55 // when computing the weight for a channel, consider its CAPACITY in this proportion
}

// Virtual fee for additional hops
// Corresponds to how much you are willing to pay to get one less hop in the payment path
hop-cost {
fee-base-msat = 500
fee-proportional-millionths = 200
}

mpp {
min-amount-satoshis = 15000 // minimum amount sent via partial HTLCs
max-parts = 5 // maximum number of HTLCs sent per payment: increasing this value will impact performance
}

percentage = 0 // set all experiments to 0% of the traffic by default
}

// One section per experiment
// The percentages of the traffic for different experiments must sum to 100.
// After starting an experiment, if you want to modify it you should give it a new name. If you don't, then you'll
// end up with metrics for different sets of parameters under the same name.
experiments {
control = ${eclair.router.path-finding.default} {
percentage = 100 // 100% of the traffic use the default configuration
}

// Examples of other configs as 0% experiments:

// To optimize for fees only:
test-fees-only = ${eclair.router.path-finding.default} {
ratios {
base = 1
cltv = 0
channel-age = 0
channel-capacity = 0
}
hop-cost {
fee-base-msat = 0
fee-proportional-millionths = 0
}
}

// To optimize for shorter paths:
test-short-paths = ${eclair.router.path-finding.default} {
ratios {
base = 1
cltv = 0
channel-age = 0
channel-capacity = 0
}
hop-cost {
// High hop cost penalizes strongly longer paths
fee-base-msat = 10000
fee-proportional-millionths = 10000
}
}

// To optimize for successful payments:
test-pay-safe = ${eclair.router.path-finding.default} {
ratios {
base = 0
cltv = 0
channel-age = 0.5 // Old channels should have less risk of failures
channel-capacity = 0.5 // High capacity channels are more likely to have enough liquidity to relay our payment
}
hop-cost {
// Less hops means less chances of failures
fee-base-msat = 1000
fee-proportional-millionths = 1000
}
}

// To optimize for fast payments:
test-pay-fast = ${eclair.router.path-finding.default} {
ratios {
base = 0.2
cltv = 0.5 // In case of failure we want our funds back as fast as possible
channel-age = 0.3 // Older channels are more likely to run smoothly
channel-capacity = 0
}
hop-cost {
// Shorter paths should be faster
fee-base-msat = 10000
fee-proportional-millionths = 10000
}
}
}
}
}
Expand Down

0 comments on commit 768a745

Please sign in to comment.