Hey there - we’ve noticed that our SNS Index canister is consuming cycles at a rate that’s costing us around $100 every 10 days, which adds up to nearly $4,000 annually.
That’s a significant outlay for a single canister. Do you have any ideas on how we might reduce this usage or optimize the setup? Open to any suggestions - this level of spend doesn’t feel sustainable.
I remember in one of the R&Ds 2-3 months ago they presented a tool which could show you which functions or code lines consume most cycles and where you could optimize the codebase, thought it was already in DFX but I’m not sure, would need to rewatch the RND to check it out, but we could do a analysis of the canister code with that tool and see which functions use the most cycles
about 198TC/$330 for ~1 month, not including our 14 custom dapp canisters, which all burn about 0.1 to 3TC a month minus two heaver-lifters that burned 43TC and 7TC last month (call it 60TC for dapp canisters per month)
not as bad as Nuance’s, but majority of our hosting costs go to SNS infra cans, all ears for analysis tools
The canister index costs are (most likely) due to regularly polling for new transactions (I don’t know the parameters for SNSs but that could be as much as twice/second). That would yield a base cost of at least: 3 x 2 x 10 x 24 x 3600 x 5Mil instructions in 10 days. (The first multiplier comes from the timer implementation: there are three message executions per timer call, afaik. The last multiplier is the base cost of a message execution).
One way to deal with it would be to reduce the polling interval (not sure how it can be done on SNS managed indexes though, and if the implied delayed in updating transaction information would be acceptable for wallets).
An option that we have discussed (but didn’t get to implement due to other priorities) is to switch the index from a poll based to a push based model.