Canister call slow (0.6.2)

Hi, so I’ve started going through the tutorial, and on the my_counter example getting some strange behaviour. I’m not exactly sure what to expect but…

// Create a simple Counter actor.
actor Counter {
stable var currentValue : Nat = 0;

// Increment the counter with the increment function.
public func increment() : async () {
    currentValue += 1;

// Read the counter value with a get function.
public query func get() : async Nat {

the get() function returns instantly, but the increment function takes 5 seconds. This is the same behaviour locally and --network tungsten. The increment and get functions work fine, just the delay feels like something is wrong.


The difference is that the get() function is a query function which doesn’t alternate state and thatfor returns very fast. The increment() function is modifying state and has to go trough consensus, which is why it takes longer than the get() function. Although 5 seconds really is a long time, usually it should be 1-2 seconds I’d guess.

1 Like

Right ok, I had a few other things running on my computer so that could explain the slowdown. Is the 1-2 seconds something that we’d expect in the future or are there planned ways to reduce that?

I know you can send an update and wait for the response asynchronously, just curious on what to expect.

I think currently 1-2 seconds is realistic for the near future. The goal is to design the overall architecture of the canisters and programm in a way that state modifying calls either rarely appear or can be handled “efficently”. I can only recommend this article to get an idea


Ok cool, working my way through the simple examples then I’ll have a look at Reversi. Thanks!

1 Like

Also keep security in mind when using query calls, since you’re usually trusting the result from a single replica. Just be aware of that for critical data when designing.