I did some testing on the performance of the XSLT transformation on a very large form (Bao's). Turns out that this takes up 100% CPU utilization for an extended period.
AWS t1.micro instance: 10 minutes
AWS t1.small instance: 3 minutes
local VM with one 3.1GHz core: 36 seconds
Memory upgrade has no noticeable (under light load) impact (612Mb seems fine on local VM), nor has multiple cores (on local VM).
There are likely to be further improvements to be made in the XSL stylesheet. The key remaining issue is the way text strings are included in the form format, which is just very inefficient for XSLT to deal with. This takes up 85% of the transformation time. So a solution may be to move this work to the client (after XPath performance has been improved). Caching of the transformation results will help a lot but for every first time a long form is requested from enketo as well as for all preview loads, the transformation time is not really acceptable for forms with a lot of text strings.
Can we upgrade
enketo.formub.org to t1.medium ($826/year) or probably even better to a high CPU-medium ($1050) instance, for the near future?