I made a questionnaire with php and javascript, that's all right. Just a little detail I'm not sure what the best way to do it.
The questionnaire has a time to be answered, and I would like it if the responding user leaves the page or updates, the time starts to count from where he left off. I thought of doing an ajax request recording in the bd every 2s the time, but I would like to avoid something that made so many requests to the database in such a short time so, even more that the system is in amazon, I want to avoid not to generate costs additional.
I thought in other ways, such as sessions and cookies but either one is not efficient for this.
If you can help me I'm very grateful, I just need a hint of what would be in your experience a more viable option.