Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Client-Side Logic and Performance Issues

  • jordan_mcguigan
  • jordan_mcguigan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 6 months ago #112113 by jordan_mcguigan
Client-Side Logic and Performance Issues was created by jordan_mcguigan
Hello,

We are trying to build a summary at the end of the survey we are making in which they can answer further based on their responses earlier in the survey.

We have some logic that we have determined can only be handled in client side JavaScript in combination with references to previous questions in template codes. We build up an array of enabled questions based on previous answers, then hide the ones that are not enabled. There is several template codes to previous questions and they seem to be causing performance issues with our Lime Survey instance. Removing the questions alleviates the issues, adding them back in causes performance degradation.

What are the practical limits for template codes? We are using about 1870 template references in a single question because the question repeats 10 times, and under that same question there's about 10 possible subquestions, and about 10 combinations of expected answers. Thus, there's about 800 lines of JavaScript code (when properly formatted), plus 100-200 lines of function logic for this one troublesome set of questions. This all gets code generated from a spreadsheet of possible responses and it isn't hard to make and unmake in Lime Survey.

We're seeing page load times on a Amazon EC2 c3.xlarge instance jump from 1-2 seconds to easily 2-3 minutes. This increased load time is happening across all pages, not just the pages the template codes are referenced. The database server is living in a separate EC2 instance. CPU was easily 100% every request on a m3.medium instance but now that we've bumped it up a notch it never exceeds 40%.

In the long term, we'll have to drastically redesign the survey, but in the short term is there anything we can do to alleviate the performance problems? Is there a reason why an exceptionally large question will cause the entire interface to be slower, not just the pages where the question appears?

Basically, we're trying to build a summary at the end of the summary using text arrays.
The summary has three tiers.
In tier 1, there's a title. Tier 1 is a array of texts "question" in Lime Survey. There's about 20 tier 1 questions. A tier 1 question is controlled using a relevancy equation based on previous responses. We currently have them disabled (set to 1) for debugging.
In tier 2, there's a title. Tier 2 is a "header" in the array of texts of the question in tier 1 that we hide in JavaScript the ability to answer. We only show these if they are relevant based on previous responses.
In tier 3, there's a title and an answer box. Tier 3 is the actual fillable row in the array of texts in tier 1. We only show these if they are relevant on previous responses.
Overall, a question will trigger a tier 3 answer to show up, and that will require it's parent tier 2 to show up, and that will trigger the appropriate tier 1 parent to show up.

Help is appreciated, however we have a encroaching deadline so we will not be able to make any major design changes until after our demo.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose