DMTF / python-redfish-library

Python3 library for interacting with devices that support a Redfish service
Other
168 stars 181 forks source link

Request body size can be cut down to improve transmission efficiency #32

Open panyy3 opened 5 years ago

panyy3 commented 5 years ago

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?

panyy3 commented 5 years ago

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.

panyy3 commented 5 years ago

Useless blank is removed from request body after improvement.

mraineri commented 5 years ago

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.

panyy3 commented 5 years ago

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.

mraineri commented 5 years ago

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).