I am running a private IPFS gateway, frontend by nginx.
This serves requests from users in the local network.
Would like to understand how the IPFS gateway handles concurrent requests for the same CID. Will it fetch the file from the IPFS network twice ?
Or will the second request wait on the first request to complete, and then use the locally cached (in fs repo) data…
I am more or less sure that it should not fetch content more than once. As the blocks are received, request may be served in parallel (one request should not make the other hang).
Thanks, I’ll try to dig up a bit more (for convincing myself).
Planning to do some blackbox testing first.
Based on the results of that, I’ll decide whether to jump into the source code or not.
If the block requests want is not available locally, it will be bitswap trying to fetch it. go-bitswap would be the place to verify that bitswap is correctly pooling block-WANTs requests and serving all requests for a block when they arrive (I assume so, but not 100% sure).