I went to a few websites and noticed that they all use AJAX technology for many tasks such as chat, messages, and so forth. They use a lot of httprequests obviously. My question is if you build a simple website using AJAX and you expected only few people per hour and then you start to have like 1,000 members logged per hour - can a single web application handle more requests per hour if you just upgrade to faster bigger servers or do you have to rewrite the code? Exactly how do you "scale" the web application?
That's a very, very involved question that lots of smart people spend lots of time thinking about.
That said, there are a few tried and true mechanisms you can introduce that will help with scalability. Ultimately, though, it boils down to your application and how it should specifically be scaled. For example, you would scale Oracle differently than you would scale Apache.
First and foremost, don't worry too much about what might happen. Far too many developers worry about the "perhaps" instead of worrying about the "now." The vast majority of applications and web sites do not require anything out of the ordinary.
That disclaimer aside, there are generally some principals that should be followed when designing and coding a highly scalable application. The concept of "shared nothing" comes to mind. Separation of concerns. Good developers recognize this and can build on it from day one.
A list of commonly implemented techniques:
I'm sure I'm forgetting something as I'm pulling all of this out of memory, but you get the idea. At the core, the application needs to be designed to be scalable. If you have that, it's possible to spread load and grow indefinitely by deploying a smart architecture.