I have an API that is built with S3 AWS. The API relate to the Image process with Face recognition.
I have a ModelSerializer. The create function of the serializer will get the Image from the body. The `image` will process with more functions are `convert_from_blob_to_png`, `create_thumbnail` and `create_watermark`. After each function is completed, I also need to upload each 4 images (including original image) to S3. And it has more functions like `face recognition` in this function. But the problem is when I request 5 or more requests in the same time the server will freeze and the function on image also increase running time. Below is the time that take while process the image. The result is second.
The more I make concurrency requests, the more functions take time to run.
I wonder why it increases the time because the images are the same. Is there any way to debug or improve? I use Pillow and wandImage for process on image. The server is EC2. The server will freeze around 10 requests.