I am interested to know how the Aws's S3Client's GetObject function work behind the scene. From the API doc, we can see it's using some streaming to write the output to a file or to a memory buffer: https://sdk.amazonaws.com/cpp/api/LATEST/aws-cpp-sdk-s3/html/class_aws_1_1_s3_1_1_model_1_1_get_object_request.html because we need to call SetResponseStreamFactory()
function.
One question is: what are the network operations here? Is it:
- a http request goes to the server, the server returns a http response with a gigantic body (if the file is 1G, the body is 1G)
- or, a http request goes to the server, the server will gradually returns some data to the client, and the client will write the data to the ResponseStream?
The first theory will consume large amount of memory, so I would like to confirm it's not the first theory. I tried finding the answer in aws-sdk-cpp source code, but it seems hard to find any conclusion.
The question I am mostly interested in is: if downloading a 1GB file, when the GetObject() function returns, did the client's host node allocate 1GB memory space for this downloaded file? or the file is still being downloaded? what if the ResponseStream digest data very slowly?