# Extern canister call

**URL:** <https://forum.dfinity.org/t/extern-canister-call/29392>\
**Category:** Developers\
**Created:** [April 6, 2024, 3:56pm UTC](https://forum.dfinity.org/t/extern-canister-call/29392 "2024-04-06T15:56:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaxopaxo](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jaxopaxo](https://forum.dfinity.org/u/jaxopaxo)\
**Post date:** [April 6, 2024, 3:56pm UTC](https://forum.dfinity.org/t/extern-canister-call/29392/1 "2024-04-06T15:56:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [April 6, 2024, 5:22pm UTC](https://forum.dfinity.org/t/extern-canister-call/29392/2 "2024-04-06T17:22:41Z")

</div>

Hi, If you just want simple query call take a look at [Composite queries](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/advanced-features/composite-query).

---

<div class="post-metadata">

**Author:** ![jaxopaxo](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jaxopaxo](https://forum.dfinity.org/u/jaxopaxo)\
**Post date:** [April 6, 2024, 5:43pm UTC](https://forum.dfinity.org/t/extern-canister-call/29392/3 "2024-04-06T17:43:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [April 8, 2024, 7:58am UTC](https://forum.dfinity.org/t/extern-canister-call/29392/4 "2024-04-08T07:58:35Z")

</div>

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
