Trying to load the Big Buck Bunny CID via the http gateway takes about 15 seconds to start playing for me. I've managed to get it down to 5-10 seconds with some bitswap optimisations but that's still a really long time.
What's happening is the DAG is wide so Helia gets loads of CID requests in quick succession and it takes time to resolve them. This is great for fast file transfer but terrible for video streaming where we just want the first block as fast as possible.
Setting blockReadConcurrency to 1 (e.g. read one block at a time instead of a whole DAG layer at a time) when .cating the file lowers playback start time to under a second.
To do this more properly we should probably sniff the content type of a file by reading the first block, then set the block read concurrency accordingly (high if it's a file, low if it's a video or image (for progressive rendering?)).
Trying to load the Big Buck Bunny CID via the http gateway takes about 15 seconds to start playing for me. I've managed to get it down to 5-10 seconds with some bitswap optimisations but that's still a really long time.
What's happening is the DAG is wide so Helia gets loads of CID requests in quick succession and it takes time to resolve them. This is great for fast file transfer but terrible for video streaming where we just want the first block as fast as possible.
Setting blockReadConcurrency to
1
(e.g. read one block at a time instead of a whole DAG layer at a time) when.cat
ing the file lowers playback start time to under a second.To do this more properly we should probably sniff the content type of a file by reading the first block, then set the block read concurrency accordingly (high if it's a file, low if it's a video or image (for progressive rendering?)).
This will be easier with #42 in.