I’ve been using Sajax for quite a while, and hacked it in several ways to match my needs. However, there is one problem that it has which I can’t get around simply; massive parallel requests. If there is 100 ajax requests that need results, Sajax creates 100 separate http requests. This can slow things down immensely.
In the demo, I’ve initiated 4 loops, each of which makes 100 requests. It took me 51140ms for the requests to complete. My goal is to bring that down to less than 500ms.
I have not created the solution yet. Just wanted to show the problem while I work on it.
The specification that I’ve settled on is:
- should work similar to Sajax. ie; server functions are called with “x_functionBlah(var1,var2,callbackFunction);”
- variables are transferred using JSON
- allow server-side functions to be defined from completely separate URLs
- delay sending the requests, in order to collect multiple requests to the same URL and send them all as one.
I figure this would massively improve any AJAX application which uses multiple parallel requests.
Unfortunately, Sajax is just not suited for handling this, so I will need to write my script from scratch. Gosh – my own AJAX framework.
I’ve already dubbed the new framework “KaeJAX”, because I’m vain and like bandwagons.
I will hopefully have a working example later today.