[requirements][placement] orjson instead of stdlib json

Chris Dent cdent+os at anticdent.org
Wed Aug 28 08:47:22 UTC 2019


Requirements people:

For the past few months we've been doing profiling of placement,
modeling large clouds where many results (7000 resource providers)
will be returned in response to common requests.

One of the last remaining chunks of slowness is serializing the very
large dicts representing those providers (and associated allocation
requests) to JSON (greater than 100k lines when pretty printed).
Using the oslo jsonutils (which is a light wrapper over the stdlib
'json' module) approximately 25% of time is consumed by dumps().

Using orjson [1] instead, time consumption drops to 1%, so this is
something it would be good to make real in placement (and perhaps
other projects that have large result sets). There's a WIP that
demonstrates its use at [2].

I'm posting about it because JSON serialization seems like it might
be an area that the requirements team has greater interest than some
other areas.

Also, orjson is only Python 3, so use needs to be adapted for Python
2, as shown in the WIP [2].

Otherwise it's fine: active, Apache2 or MIT license.

Thoughts?

[1] https://pypi.org/project/orjson/
[2] https://review.opendev.org/#/c/674661/



-- 
Chris Dent                       ٩◔̯◔۶           https://anticdent.org/
freenode: cdent


More information about the openstack-discuss mailing list