Hi!
Could someone help, when I call an extern canister from a canister it takes more than 3 seconds, and when I call the canister directly it takes almost no time?
Hi, If you just want simple query call take a look at Composite queries.
No it is not the call it self the problem, the issue is that
I have a deployed gateway_canister_1 from a project_1 which calls a function in another backend_canister outside the project_1
when I call a query function directly on backend_canister it takes no time, but if I call the same function but via gateway_canister_1 it takes more then 3 seconds, as I suspect the delay is because of they are in two different sub_nets, is there any way to optimize?
Going cross-subnet usually costs at least 4 blocks (~4 seconds). The only way to optimize that away is to create your canister on the same subnet. dfx canister create
, dfx ledger create-canister
, and dfx deploy
now support the --next-to
flag so you can ask it to put the canisters next to the other project