python-jsonschema / jsonschema-specifications

Support files exposing JSON from the JSON Schema specifications to Python
https://jsonschema-specifications.readthedocs.io/
MIT License
10 stars 7 forks source link

performance degradation from 2023.7.1 to 2023.11.1 #31

Closed rcarpa closed 10 months ago

rcarpa commented 11 months ago

Hi team. We just upgraded from 2023.7.1 to 2023.11.1 and our CPU utilization increased by almost an order of magnitude with the same workload. We use this package indirectly via jsonschema == 4.18.6.

Are you aware of what could cause such an issue. If yes, is there an easy workaround?

The affected line of code is here. In case it can help you with the investigation.

https://github.com/rucio/rucio/blob/0290623118d0890e799b848d72f2c1a3b18b2b04/lib/rucio/core/trace.py#L356C13-L356C21

Julian commented 10 months ago

There are essentially no functional changes to this library whatsoever between those two versions, so something else is happening. I'd need to see a minimal reproducer -- you've already profiled your code and seen it's this library specifically that's involved?

rcarpa commented 10 months ago

This library is not a direct dependency of our code. It comes as a dependency of jsonschema (which is pinned in our dependencies to jsonschema~=4.18.4).

https://github.com/python-jsonschema/jsonschema/blob/b307f310f86b191dd266bfba1de0eea61f0ee194/pyproject.toml#L38

I can trigger the high CPU usage by doing

pip install jsonschema-specifications==2023.11.1

and bring things back to normal with

pip install jsonschema-specifications==2023.7.1 

Nothing else changes in the meantime (no other sub-dependencies get re-installed by these commands)

Julian commented 10 months ago

I see the issue, should be fixed in a moment with a new release. Thanks for the report.