Canister cycles balance quickly declines until freezing

My api canister suddenly began consuming cycles at an elevated rate. It can consume 2T cycles within a span of 20 - 30 minutes depending on how many calls I make.

Once the cycles balance falls below the freezing threshold, the canister freezes where I then unfreeze it by lowering the freezing threshold and after doing so, my canister’s cycles balance returns to the level it was at before beginning to decline.

What would be causing this behavior? The canister only began to do this today. It began abruptly and without me making any changing to the code that the canister has been running for the last several weeks.

Could this be an issue related to degraded performance in the subnet that the canister lives on?

here is the canister’s info

1 Like

That subnet got a bit busier today than it was before.

Does your canister do a lot of outcalls? A common pattern you can observe with outcalls is that it need to prepay a lot of cycles for a large response, and then get it back when a small response actually arrives.

Maybe because of the busier subnet your responses take longer to arrive and you now have more parallel calls in flight.

2 Likes

Thank you for adding context. the issue has subsided for the time being.

The canister does perform regular polling the ledger canister every 30 seconds.

1 Like