29 Aug

kaejax

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.

demo

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.

4 thoughts on “kaejax

  1. Pingback: » kaejax demoed » klog

  2. It’s fully working and stable.

    Unfortunately, I don’t have it available as a single library that can be plugged into a website, but you can see it in action by looking at KFM (http://kfm.verens.com/). If you look at the requests that are sent to the server (use Firebug to watch them), you can see that many things are requested at the same time.

    There are improvements such as optionally using PHP’s compiled-in json_encode() functionality for even faster response, and …oh – just look at it 😉

    You are free to take out the kaejax code and use it for your own purposes. I haven’t got around to creating a standalone library for it yet, but might do, someday!

  3. Pingback: klog » Blog Archive » lazy loading functions in javascript

Comments are closed.