Taking more Time to Serialize

DRF taking more time, no extra workers in serializing. Using ModelSerializer , Any solutions ?..

Welcome @logi !

I think we’re going to need more details about the environment and what you’re comparing this to.

Start with identifying what versions of Python, Django, and DRF are involved. Also describe how you’re running your project, and what you’re saying is taking more time.

(We’re probably going to have more questions after this, but this should be enough to get started.)

Python - 3.11.1
Django - 5.0.1
djangorestframework - 3.14.0

I’m running my project inside a Docker Compose environment, using Nginx as a reverse proxy. The entire stack is hosted on an AWS t3.xlarge

More about my query time is only 48ms but my overall time is 544ms . Nothing more than ModelSerializer I’m using in my serializer.py

You could try using a profiler to see where in the serializer the time is being spent.

Or, you can post the model(s) and their serializers being used in this request and we might be able to see what’s happening.

I’ll try profiler but DRF’s serialization step is taking longer than the database query.

That’s why you would want to run a profiler on the serializer - to try to identify where in that process the time is being spent.