Stacked requests / CPU usage

Skip to first unread message

Yuri Vorontsov

Jul 2, 2014, 4:12:29 AM7/2/14
We currently use AmplifyJS to handle all AJAX requests in combination with pub/sub for updating models and storage for caching etc.
It works wonderful except in the following conditions:

- you have a slow network connection or a slow overloaded server.
- the user keeps clicking, adding a lot of stacked requests on top of the already running requests.
- at a certain point Chrome and Firefox turn unresponsive with CPU load approaching 100%. From this point on all processing is getting very slow and you have to kill the process eventually.

You can easily reproduce these conditions using Gremlins.js or any other frontend load testing script. 
A plain jQuery post works fine. It is Amplify that causes these issues. I searched the documentation but I couldn't find a way to either:

- throttle the requests
- abort all running requests when a new request is started.

Am I missing something? Can you please point us in the right direction?
Thanks a lot! 


Chris Marisic

Jan 17, 2015, 6:33:15 PM1/17/15
I don't see this as a problem with amplify, this is a problem with your UI. Your application should be throttling user actions (disable buttons when it's invalid to click them) or throttle/debounce actions that would raise these amplify requests.

UnderscoreJS should be a big help here, but it sounds like you're already familiar with packages similar to this, IDK what gremlins is but I assume it provides throttle/debounce somewhere.
Reply all
Reply to author
0 new messages