jeudi 28 juillet 2016

How to reduce ajax calls to server when using form autosave

Scenario:

Company in which I'm working is developing a website. User fills each field, it is validated and then on lose focus is sent an ajax to save data. We are also using debounce to reduce the calls to server, but it is still not enough.

Issues:

From user perspective there are no issues. Although, whenever we run automated test nightly builds (in parallel on multiple machines), the ajax requests are too many. There is a moment when response comes back slower and slower, and after some time the difference is noticeable, tests failing.

I though maybe there is another way to reduce ajax calls, for example, within time period (5 seconds etc.) these calls are saved into some kind of a list and after that time sent to server as one ajax call.

Questions:

  • How to implement behavior where in specific time period all ajax requests are stored in list and then sent as only one request (chunk)?
  • Is there a pattern like this or better way to reduce ajax calls to server?

Aucun commentaire:

Enregistrer un commentaire