DMTF/python-redfish-library

Request body size can be cut down to improve transmission efficiency

Opened this issue · 6 comments

Request body size can be cut down to improve transmission efficiency

When reading the source code, I found that request body size can be cut down to improve transmission efficiency if update the line L712 in file python-redfish-library-master/src/redfish/rest/v1.py.
Before improve:
body = json.dumps(body)
After improve:
body = json.dumps(body, separators=(',',':'))

So I suggest to update code to improve transmission effeciency. Can anyone help on this?

Compare the request json body
Before improve:
{"data": [48, 79, 121, 66, 84, 70, 120, 97, 84, 122, 74, 51, 43, 101, 88, 73, 51, 109]}
After improve:
{"data":[48,79,121,66,84,70,120,97,84,122,74,51,43,101,88,73,51,109]}
From the comparison, we can know that request body size is cut down, so the transmission efficiency is improved.

Useless blank is removed from request body after improvement.

While we can see that it's definitely removing extra characters, do you have any measurements for performance improvements with this change? We don't suspect that there would be much change since since most of the time would be spent in opening/closing the connection, and not necessarily on the body of the payload.

Yes, you are right. Most of the time would be spent in opening/closing the connection.
Although I have no measurements for this change, request body payload size will also impact the Redfish service server side's dealing. Server will need more space to deal the body payload with useless blanks, and will easily to reach the dealing body size limitation. This change will help to avoid this kind of problem.

We could add it as an optional parameter to compress the payload. Realistically speaking, we're not seeing a huge problem with size limitations in client requests (generally speaking, they tend to be over 1MB).