Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow startup when defining many filters #519

Open
arthanson opened this issue Apr 18, 2024 · 5 comments
Open

Slow startup when defining many filters #519

arthanson opened this issue Apr 18, 2024 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@arthanson
Copy link

arthanson commented Apr 18, 2024

Startup time for the app increases linearly as more filters and annotated types are added.

Describe the Bug

We have converted NetBox from graphene to Strawberry - one things we noticed is a large jump in startup times, tracing this down it was from Strawberry processing all the filters and annotated types (we have a lot defined). When using graphene there was no noticeable delay in startup time.

timing to create the schmea without the filterset annotations: 219.61 ms
timing with the annotations: 4568.14 ms

The startup delay is fairly linear as you add more and more filter fields. Unfortunately it is difficult to provide an example project as it is only noticeable when you have a large number defined.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@arthanson arthanson added the bug Something isn't working label Apr 18, 2024
@patrick91
Copy link
Member

The startup delay is fairly linear as you add more and more filter fields. Unfortunately it is difficult to provide an example project as it is only noticeable when you have a large number defined.

how large? 😊

@arthanson
Copy link
Author

In our case we have 105 Filters / Models and 2333 filter fields (average 22 / Filter), but it goes up fairly linearly, so with half the number of items it would be about 1/2 the delay, so I'm guessing you would need around 300 filter fields across several models to really start noticing it.

@bellini666
Copy link
Member

@arthanson that's interesting. I wonder if the most recent refactor of filters made it worse...

As I don't have something that large to test, could you help us by providing a sampling profile of your startup execution? You can use https://github.com/benfred/py-spy or something similar for that

@Kitefiko
Copy link
Contributor

Hello,
I would like to way in on this, that is, overall slow startups for larger projects.

This might be good place to try push for Object Type Extensions.
I have created prototype, that I currently (with monkey patch unfortunately) use for my own project.
The idea is to be able to customize fields directly during strawberry's _process_type and not being forced to loop over and override already created fields.

I do not know. If going a "monkey patch" way would be acceptable, but I could do demo for this lib, if your guys would see potential in this?

@bellini666
Copy link
Member

Hello, I would like to way in on this, that is, overall slow startups for larger projects.

This might be good place to try push for Object Type Extensions. I have created prototype, that I currently (with monkey patch unfortunately) use for my own project. The idea is to be able to customize fields directly during strawberry's _process_type and not being forced to loop over and override already created fields.

I do not know. If going a "monkey patch" way would be acceptable, but I could do demo for this lib, if your guys would see potential in this?

Just saw your prototype and I like the idea! :)

Left a couple comments in there, but it seems simple enough for me. I'll discuss it with @patrick91 soon (he is our currently for personal reasons)

@bellini666 bellini666 added enhancement New feature or request help wanted Extra attention is needed question Further information is requested and removed bug Something isn't working labels Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants