Improve performance about concurrency request with heavy tasks that make the server freeze and down.

34 views
Skip to first unread message

Chrea Chanchhunneng

unread,
Jul 19, 2024, 12:34:47 PM (3 days ago) Jul 19
to Django users
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.

Screenshot 2024-07-18 at 11.44.35.png

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.

Ryan Nowakowski

unread,
Jul 19, 2024, 5:01:53 PM (3 days ago) Jul 19
to django...@googlegroups.com
Have you profiled your code to see what parts are taking longer as concurrency increases?
Reply all
Reply to author
Forward
0 new messages