json loads taking unusually long time while running inside kubernetes pod

12/11/2018

I have a http django server deployed through docker container in a kubernetes cluster.

Issue is - json.loads in post request is taking too much time(~400ms) for 50Kb Json only. I tried the json.loads from shell_plus inside the pod, it is taking normal timing(<1ms).
Also same django application is taking normal time in my local setup.

What could be issue, that with django application same process is taking too much long inside pod ? How to debug such issue?

I am logging json load time like this -

import json


t1 = datetime.datetime.now()
request_json = json.loads(request.body)
print("time taken by json loads is {}".format(datetime.datetime.now() - t1))

Server configuration -
django application via gunicorn server inside kubernetes pod

Tried - Increasing CPU utilisation, memory utilisation
different json parsers like (json and ujson), tried cpickle as well.

-- Paras Mishra
django
json
kubernetes
python

0 Answers