We are finding that using AWS file storage (EFS or EBS using GP2 or GP3) from an EC2 instance is very slow when doing simultaneous reads. Here's an example:
I'm reading 30 binary files into memory, totaling 46 MB.
Doing this once takes about 16 ms. However, if I spawn 8 parallel processes on the same EC2 instance, each reading different sets of 30 binary files, each one takes an average of 105 ms (556% slower than a single process). It's almost like the 8 reads are happening serially instead of in parallel (though not quite). Note: There is no writing happening to these files at the time.
If I repeat the same test on my laptop, using local file storage, the same 8 simultaneous reads of the same files are each only about 70% slower than a single read.
Why is the performance hit of simultaneous reads of the same file so much greater using AWS storage?
Is there anything I can configure about the volume that would reduce that performance penalty?
Update: This does not seem to be dependent on reading the same files. I get the same performance whether each process is reading the same 30 files or 30 different files. Title and details updated to account for this.