We are building a web application that would use the following technologies:
3) Tomcat 4) MySQL database
The site would have 120K to 140 K users. We need to build a scalable server that can support so many users and one that has a good
response time. Can anyone please pool in suggestions, tips, etc on how to go about this.
Which design patterns we could use, what sort f optimizations can be applied while building the site?
One of the most important things you can do is remain flexible. For example, MySQL may or may not be the most appropriate database. Fortunately, Hibernate - or better yet, Hibernate JPA can abstract the database details in case you need to replace it with Oracle or even PostgreSQL. Additionally, there are commercial plugins to JPA technology such as as the Tangesol cache that might prove useful. This is one of the reasons that ORM is better than raw JDBC as you scale up - it's easier to install a plugin that it is to do a massive low-level code re-architecting.
Spring is also beneficial in such instances, since it makes it easier to plug-replace underperforming components.
Very likely you'll need clustering capabilities, so design accordingly. But overall, it's more important to keep the design clean. It's easier to optimize a clean system than to clean up an "optimized" system that wasn't clean and wasn't even optimal.
As we've said here before, don't optimize prematurely. The bottlenecks are rarely where you expect them to be, so you'll just make for a dirtier design and a lot of useless effort.
An IDE is no substitute for an Intelligent Developer.