Optimize the proposals loading performance#13701
Conversation
2714e6f to
82755f8
Compare
82755f8 to
25ad359
Compare
|
Also I forget to add a little tiny detail in my review 😃 It works in my machine 🥳 🎉 ! This is what I'm doing for checking it out:
require "decidim/seeds"
require "decidim/proposals/seeds"
component = Decidim::Component.find_by(manifest_name: "proposals")
900.times { Decidim::Proposals::Seeds.new(participatory_space: component.participatory_space).create_proposal!(component:) }
tail -f development_app/log/* |grep "Completed"
These are the numbers that I'm seeing: A) On
B) On
So, it seems like we're improving in almost every metric, most notably in the load times and the allocations numbers |
It asks for access, can you open the access? (if it doesn't have any PII of course) |
decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb
Show resolved
Hide resolved
check now . There is no private info in it (the stats are extracted from a seeded decidim instance). |
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Development environmentDisplay in List mode before changes no cache Display in Grid mode before changes no cache Display in List mode before changes with cache Display in Grid mode before changes with cache Display in List mode after changes with cache Display in Grid mode after changes with cache Proposal view in Grid mode
| Before optimization | After changes
-- | -- | --
| no cache | cache | no cache | cache
Time taken for tests | 815 | 529 | N/A | 216
Requests per second | 0.12 | 0.19 | N/A | 0.46
Time per request | 40757 | 26496 | N/A | 10839
Time per request ( MEAN) | 8151 | 5299 | N/A | 2167
|
|
Sorry, I was trying to add the google docs content here but I pressed the wrong button. Just FYI @alecslupu: we don't do Google Docs for PRs, as it's using outside documents its a cancer for an Open Source project. Some time from now both of us could be out of the project and the new maintainers (or future researchers) may not have access because you removed, closed your google account or whatever other thing that may happen. For this kind of contents it's much better to work it on a GitHub Gist and then copy and paste in the PR, so it's self-contained and we don't have future problems. Now we can leave it as is, because it's not worth actually redoing the whole document in GH markdown format and it's not a thing that can be copy and pasted (as HackMD or Notion that somewhat maintains the formatting). (I added it, but the format is awful, and I don't want to waste time on fixing it) |
Attached the PDF version of the previously pasted docs (Yes, i know you already pasted them) |
|
Can you merge with latest |
|
@andreslucena We have a green pipeline |
* Optimize the proposals * Fix failing specs * Apply suggestions from code review Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Running linters * Remove geocoded variable if the maps are not available * Fix function description * Codeclimate --------- Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
🎩 What? Why?
Recently Decidim Barcelona had some issues with the proposals, and in an effort of optimizing the page, i could observe that the proposal cell is dependent of author , which increased a lot the memory and cpu usage. In an attempt to optimize this, we noticed that Proposal cell cannot be optimally cached due to author and current user relation. to split that we decided to move the tooltip to an AJAX approach. Doing this, i could observe the following improvements using AB (aiming 100 requests, with a concurrency of 5)
List mode
Grid mode
Additionally, i have seen there is no cache that is being used
📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📷 Screenshots
more details here: https://docs.google.com/document/d/1vR5ck119qNZ1ds6qniefxfgYVC0-voKOWoL-FcsLf9E/edit?usp=sharing