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

Bullet gem in development mode #9943

Open
Tlazypanda opened this issue Jul 24, 2021 · 5 comments
Open

Bullet gem in development mode #9943

Tlazypanda opened this issue Jul 24, 2021 · 5 comments
Labels
feature explains that the issue is to add a new feature

Comments

@Tlazypanda
Copy link
Collaborator

Please describe the desired behavior.
Given the performance issues we have been facing lately, was thinking of adding Bullet gem in the development mode and necessary config. We can then add some documentation to suggest contributors to check their added queries and whether they are performant or not before opening a pull request. There is also a possibility of adding bullet in tests but will have to check out how it exactly works.

Bullet gem will flag issues such as N+1, unnecessary eager loading etc. through log/bullet.log file, browser console and as a js alert on the page.
https://github.com/flyerhzm/bullet

@Tlazypanda Tlazypanda added the feature explains that the issue is to add a new feature label Jul 24, 2021
@Tlazypanda
Copy link
Collaborator Author

Hey Jeff! What do you think about this @jywarren? Let me know ✌️

@anirudhprabhakaran3
Copy link
Member

This is a pretty good suggestion! My college uses rails for our UIMS, and bullet has helped a lot in dev, especially for N+1 queries. I definitely think this should be there

@jywarren
Copy link
Member

jywarren commented Aug 2, 2021

This looks really nice! How would such issues be presented/displayed, like what would be an example, and how might we encourage people to read them and generate issues from them? Could we have a "support" issue for combing through these?

support

Also, would it block anything? I guess if it's integrated into tests, it might, but not otherwise?

@anirudhprabhakaran3
Copy link
Member

So, as far as I understand, bullet doesn't play any part in tests. it's used just during the development cycle, and not in tests.
Bullet doesn't prevent any bad queries from being added to the code, it'll just alert the developer to the inefficient queries. Whether we want to correct them or not is up to us.

Bullet actually displays errors as a pop-up JS alert when the page with inefficient queries is loaded. Along with that, there is a more descriptive hovering footer kind of section, that displays which query is causing the error, and if there are any quick fixes to it. Usually, the fixes that are specified are good enough.

People coming across these errors can make issues and FTOs from it. It'll help make the code cleaner, and also help drive community involvement!

@starswan
Copy link

starswan commented Mar 8, 2024

Bullet can be set into 'raise exceptions' mode where tests will fail on N+1 issues. It can be very difficult to make all the scenarios pass though - and sometimes you have to accept occasional over-eager loads depending on what the view ends up doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature explains that the issue is to add a new feature
Projects
None yet
Development

No branches or pull requests

4 participants