views:

34

answers:

3

I've got an applet that is rather large (4MB) on a web page used by a few thousand users scattered across a WAN. Bandwidths to these users range from a paltry 128Kbps to 10Mbps.

The problem occurs when a new version of the applet is made available; it is downloaded automatically by all the users browsers effectively chocking the network.

They really hate 'release day' morning around here :)

Is there any strategy to work around this problem?

Edit: I can only serve this applet centrally from one pair of servers. I cannot make any modifications to the hosting or network infrastructure.

+1  A: 

Here are some ideas:

  • Divide your user community into N equal groups, and provide a different applet URL for each for group. Then stagger the times at which each group's copy of the applet is updated.

  • Put the applet on a server that has been tweaked to lie about the applet's modification date, and use this to (crudely) throttle the rate at which browsers fetch the updated applet.

  • Push the applet to locations on the local networks of large groups of users. Have the central server issue HTTP redirects so that each browser picks up the applet from a "close" location.

  • Deploy caching HTTP proxies & autoproxy files on the local networks, and block direct access to the applet forcing the users to get the applet via the proxies.

The last option is probably the best.

Stephen C
Excellent suggestions Stephen... however my hands are tied when it comes to adding/modifying infrastructure :(
Ryan Fernandes
+1  A: 

Apart from what Stephen C mentions, I'd like to add another strategy that you should consider.

  • Consider breaking your applet codebase into different modules (archives)
  • These modules are updated instead of the entire 4MB applet. You can have a special classloader that checks if a new version of a given module is available.
  • For patches have a separate "patch" archive that loads before any other archives so that any updated classes are loaded from the patch archive instead of the older already downloaded archives.
  • The java web start already does some of these things to avoid entire updates. You can take a look the link (developer documentation) for a few pointers.
naikus
A: 

If you can put a .htaccess in the directory you can add expiresByType so that the client doesn't ask the server everytime.

Have you looked at pack200? and (pack200 + .htaccess) Have you looked at indexed Jar?

Anthony

Anthony
nice!... didnt think that pack200 could be used for applets... and yes, indexing coupled with some nifty java_arguments will help the sitution here big time. Thanks
Ryan Fernandes