views:

57

answers:

2

Ok, I'm currently writing a scheduling web app for a large company, and it needs to be fast. Normal fast (<1s) doesn't cut it with these guys, so we're aiming for <0.5s, which is hard to achieve when using postbacks.

My question is: does anyone have a suggestion of how best to buffer calendar/schedule data to speed load times?

My plan is to load the selected week's data, and another week on either side, and use these to buffer the output: i.e. it will never have load the week you've asked for, it'll always have that in memory, and it'll buffer the weeks on either side for when you next change.

However, I'm not sure exactly how to achieve this, the asynch loading is simple when using ajax pagemethods, but it's a question of where to store the data (temporarily) after it loads: I am currently using a static class with a dictionary> to do it, but this is probably not the best way when it comes to scaling to the large userbase.

Any suggestions?

EDIT

The amount of data loaded is not particularly high (there are a few fields on each appointment, which are converted to a small container class and have some processing done on them to organise the dates and calculate the concurrent appointments, and it's unlikely there'll be more than ~30 appointments a week due to the domain) however the database is under very high load from other areas of the application (this is a very large scale system with thousands of users transfering a large volume of information around).

+1  A: 

The buffering won't help on the first page, though - only on subsequent back/forward requests.

Tbh I don't think there's much point, as you'll want to support hyperlinks and redirects from other sources as much as or more than just back/forward. You might also want to "jump" to a month. Forcing users to page back and forwards to get to the month they want is actually going to take longer and be more frustrating than a <1s response time to go straight to the page they want.

You're better off caching data generally (using something like Velocity) so that you almost never hit the db, but even that's going to be hard with lots of users.

My recommendation is to get it working, then use a profiling tool (like ANTS Profiler) to see which bits of code you can optimise once it's functionally correct.

Neil Barnwell
All fair suggestions, however the brief for this is *very* specific about functionality and there are almost no entry paths other than the first page (most functionality is provided via jquery and lightboxes). A goto button is not specified, but I do agree. And I'm well aware that the first page will be slightly slower, but that will be compensated by the overall speed for the app if I can get a good buffering setup: they'd rather have a page that loads for 2s once and then goes super-fast after that than one that takes 0.5s to do every action.
Ed Woodcock
+2  A: 

So are you putting your buffered content on the client or the server here? I would think the thing to do would be to chuck the data for previous and next weeks into a javascript data structure on the page and then let the client arrange it for you. Then you could just be bouncing back to the server asynchronously for the next week when one of your buffered neighbour weeks is opened so you're always a week ahead as you have said, assuming that the data will only be accessed in a week-by-week way.

I would also, for the sake of experimentation, see what happens if you put a lot more calendar data into the page to process with Javascript - this type of data can often be pretty small, even a lot of information barely adding up to the equivalent of a small image in terms of data transfer - and you may well find that you can have quiet a bit of information cached ahead of time.

It can be really easy to assume that because you have a tool like Ajax you should be using it the whole time, but then I do use a hammer for pretty much all jobs around the home, so I'm a fine one to talk on that front.

glenatron
I was intending to do the buffering on the server-side, as the organisation code is quite complex (getting the appointment boxes in the correct place is surprisingly difficult when you take into account having to adjust the widths for concurrent blocks). The current plan is for week-by-week access only.
Ed Woodcock
The more I see about this the more I think that any processing you can offload to the client you should offload to the client. Also often the project sponsors have the fastest computers, so your output will look even faster in their machines even if it doesn't match up on everyone else's...
glenatron
Actually they all use Cranberry thin client thingies, which are not exactly super-fast :) However, I've started doing it with PageMethods generating the HTML and it's pretty fast (~0.3s) so I'm probably going to cache in the server and do the rendering via JS
Ed Woodcock