-
Notifications
You must be signed in to change notification settings - Fork 42
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
Report generation doesn't scale #42
Comments
Connor, thanks for the feedback - I really appreciate it and I'm glad the I'm not surprised to hear of the problem. I never got around to If you've started work on a branch to fix the problem, why don't you push On Sat, Jan 31, 2015 at 11:17 PM, Connor Clark notifications@github.com
|
Looks like the problem is not so much in the generate_report method, but in the views. |
Hey kjayma, I am free starting Thursday to take a deeper look. Will get back to you then :) |
Hey Connor, I started some work on this over the weekend. When I get home, I'll push On Sun, Mar 8, 2015 at 5:42 PM, Connor Clark notifications@github.com
|
Peformance tuning aside, I've been thinking of making the reports On Sun, Mar 8, 2015 at 5:42 PM, Connor Clark notifications@github.com
|
An asynchronous solution would be a good fallback. I suggest we try and get the performance as quick as possible, and then test it on a very large amount of response sets. If it's still slow, we should add an asynchronous callback URL. Sent from my iPhone
|
Pushed a new branch to work on this problem at report_performance |
I will be spending a lot of time today working on this. Hopefully we'll come to a solution :) Are there any tests for the reporting? If not, I will spend some time getting that set up. I just learned about performance tests in Rails. We can use this to keep track of our progress. This would be the best thing to do first, so we have some good before and after stats. |
I am getting this error when I run 'rake spec' "Could not load the testbed app. Have you generated it?" Looking at /test, I am really not sure what I need to do to generate it. |
There are not yet tests for reports. I banged it in quickly before starting a new job, and elected to get something up there fast in the short time I had at the expense of performance and tests. For setting up the tests, you need to run "bundle exec rake gui_testbed" before running the specs. You may also need to run "bundle exec rspec" |
https://gist.github.com/Hoten/545d346d2398c0c083d3#file-gistfile1-txt-L497 Attempting to install the testbed app. "bundle exec rake gui_testbed" produces a few routing errors. Any idea what is causing this? |
I came across a performance issue on another application last week. I fixed it by lazily loading associations for potentially large queries. Will attempt this. |
The report view are doing a lot of data base queries via 'where'. My solution is starting to look like this: changes to reports#show (
Instead of giving the view a ActiveModel query builder, I give it the responses as an array. I also eagerly load the proper association from the ResponseSet query.
I then had to travel to the report views and modify the wheres to be simple selects. Still many queries coming from somewhere. Almost there, I think. |
Last part of the puzzle! _report_data.html.haml (
Also, some report partials were calling a method called 'is_comment' (https://github.com/kjayma/surveyor_gui/blob/master/lib/surveyor_gui/models/question_methods.rb#L37) on questions. See:(
On my machine, reporting is now instantaneous for ~400 response sets. (sidenote: I am only testing with :pick_one question types). I upped it to 2400, and it took 30s... the bottleneck seems to be that scary loop in _report_data (
I'm doing all this optimization on another project, since I can't get the testbed app to work to test things. I'll attempt a merge of all the changes when I can get that working - failing that, I'll just make changes blind and let you patch up the remaining issues. |
Hello, first of all thanks so much for this great gem, it's been a huge time saves in a lot of aspects so far for my current project.
The only issue I have come across so far deals with generating reports. We have done a small launch for our application, and got 500 users to take surveys.
The issue: the surveys with 400-500 responses take too long to create a report. Greater than 30s, the default timeout time. Our hotfix solution is to cache the reports generated, and kill the cache every 20 responses or so.
I believe the generate_report method is the culprit, with all of those joins.
I wanted to open up this issue to see if anyone else has come across this. I will be attempting a solution in the coming weeks :) Any feedback or help would be wonderful!
The text was updated successfully, but these errors were encountered: