This is a pretty open question. I was wondering: how can you handle concurrency if you have a web application that is hosted on many computers on the server side? For example, how can you manage a simple stack if you have an ASP .NET application running on different machines with each one having its own memory? Is there something I’m missing?
Thanks
If I understand the question correctly: how do multiple Web servers co-ordinate to return responses?
In general a farm of Web servers will serve up exactly the same HTML to clients when a particular request arrives. If there’s a need to store state – suppose the user posts back a form with data, or session state is used to keep track of a shopping cart – then you’ll need some shared mechanism to do that.
There’s plenty of ways to share state between multiple instances of a Web server:
Things can get complex, though:
To get around this some systems use the principle of “eventual consistency”, where, for instance, a profile update might not be replicated immediately to every server in a cluster. Not-quite-fresh data is sometimes regarded as good enough.
As you can tell this is a complex subject and I’ve only really skated around the edges of it.
The good news is that generally you won’t need to bother as unless you’re creating a very large or complex site most modern server hardware can handle many tens of requests per second without breaking into a sweat. It’s only when you start to move above a few dozen simultaneous requests per second that Web farms start to be necessary.