csmac3144 wrote:
Sticky sessions can work in some situations, however they are not a full solution of the sort I am looking for. Once a client establishes affinity with a server that client's session will be lost if the node fails. Primitive affinity systems using IP addresses are prone to failure when clients come in from a proxy (e.g., AOL). Otherwise you need a cookie or something.
The scenario you describe still does not achieve the sort of multi-node, application-scoped object caching that separates J2EE/EJB app servers from .Net.
There is a perception among large system integrators (e.g., we deal with SAIC) that .Net cannot scale to handle large systems. I believe it can, however it cannot do so without a true multi-node caching system. Why Microsoft refuses to build this themselves I don't know. I expect it is because they don't seriously target the high-end enterprise market.
I think caching is something which is often done at the wrong level. Most websites are actually a read-only system with rarely a write action. If your website has write actions to the content it serves most less than it has read actions, you can win mostly by simply cache the true output and that's at a high level not at a low(er) level where the o/r mapper lives.
Java app servers have a feature which is missing in .NET and that's known as cross system object awareness: on box A you can get a reference to an object on box B without marshalling/serialization issues. On .NET it's not transparent, you have to make objects serializable, they're always copies etc.
Is that truly necessary? No. On the web, the fastest performance is achieved by simply doing a thing just once and only repeat it if you have to.
Take this trick:
- you have a dynamic system, it can render the website from data in the db. Rendering the complete system takes for example 5 seconds.
- you therefore render on that system the site every 10 seconds, from top to bottom
- you cache any output on a different box
- your users visit THAT box.
You can now serve the users a site which is never slow, you always serve them data which is roughly up to date (no user will see a delay of 10 seconds) and it can handle a very high load. If the load gets too heavy on the render server, you can increase the window, or make it more advanced: render some parts every second and other parts every minute.
The big point is that you only serve cached data, you never do something twice. This forum for example renders the posts and stores them as-is in the db. Reading a thread, the most expensive operation on a forum, is then an exercise of fetching the html to display and build the page. We could go further and cache the block of messages for a minute. As the length of the page is per user defined, we can't do that at the moment, but if that would be fixed, we could.
A high traffic website should be doing the same thing: stuff which is always shown as readonly data (and most websites are this way: users almost never are able to change the content on a website in depth ) should be rendered once and then cached and served from that cache. Why bother re-rendering it for every user? This leaves the dynamic parts and you'll see quickly that the dynamic parts which should be dynamic (e.g. a shopping cart) aren't going to bring your server down either because it's not the majority of the data served to the visitor.