I've got a peculiar problem.
Server 1A is a server with witch the users interact. Servers 2B, 2C and 2D store video content.
On a website, a html video tag is placed
<video src="server1adomain.com/videos?video=Gy12C899">
Whenever this content is fetched, a backend script on server 1A determines on which server (2B,2C or 2D) the video is stored and fetches it. Lets say it is on 2B. I do not want to wait for the whole video to be fetched from 2B and stored in 1A server, and only after all that time be send to the user. Instead, I'd like a continuous stream to be flowing from 2B to 1A and to the user simultaneously. That way the user gets the first frames of the video with minimal delay.
What is the standard solution for this problem? cURL seems to be synchronous in terms of first fetching the file 100% and than sending it forwards.
Take a look at this diagram to see what I mean:
This is mostly comment but space is limited in the comments section.
but the less the user know about internals, the better.
Why? If you can't articulate your requirements (when they seem very unusual) then its rather hard to recommend a solution.
all youtube videos are, ... hosted on the same domain, so this must be possible
Of course its possible but I am quite confident that youtube do not achieve this using the architecture you describe. And even if they served all the content from the URLs with the same vhost, it would not be implemented as you describe. The (obvious) solution to supporting such a service would be a reverse proxy fronting asymmetric hosts acting as an HTTP router.
cURL seems to be synchronous in terms of first fetching the file 100%
Only if you use the default settings. Leaving aside the possibility of carrying out multiple RANGE requests using Curl, If you specify the CURLOPT_READFUNCTION option you can read a chunk at a time from the backend and send it to the client.