I am developing an AngularJS app, and the server side PHP, step by step, implementing features and then polishing them.

I currently periodically request data from the server, of the order of a few thousand records of 5 or 6 items each. As the next step, I had planned to send a CRC with the request and have the server response with a special response to say “the data have not changed”, if that were the case, to save bandwidth and speed up the app.

Now I am about to add a grid to show data. I was thinking of a viewport of maybe 20 items, with the user either scrolling or paging through the data. Which would mean sending requests for small chunks of data (20 objects), rather than all (2,000 objects). I can handle sorting the grid client-side, but I was thinking of offering incremental search.

Incremental search would mean sending a new AJAX request with very keystroke, possibly after some debounce.

Are there any ballpark figures for this? I am trying to decide if it is a good idea, or if round trip time might cause bad UX.

Note that I am not asking for any “best” approach, just for some data which can help me decide how to implement.

  • 1
    You are asking something noone can give you, it all depends on your render time, how quick your back-end executes these queries. How many users do you have simultaneously? How much infrastructure/money are you willing to throw at this? Etc, etc. Google does real time search on token boundary, not per keystroke. – Joppe Feb 8 '17 at 13:53
  • Feel free to post that as an answer. I tend to agree. Sigh! looks like I am going to have to code it &profile it. No way around it :-( – Mawg says reinstate Monica Feb 8 '17 at 14:30
  • 1
    Most applications like this have a timer that is triggered after each keystroke. If a certain amount of time (may be less than 1 second) has elapsed since the last keystroke, you can then send the request. It is best to have at least some kind of delay, 250 ms or more, before sending the request out. Another trick is to have a minimum delay between requests. – Frank Hileman Feb 10 '17 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.