Meaningless Drivel is fun!
The moose likes Performance and the fly likes Building a scalable performant web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Building a scalable performant web application" Watch "Building a scalable performant web application" New topic

Building a scalable performant web application

Natalie Ap
Ranch Hand

Joined: Jan 09, 2009
Posts: 49
Hi all,

We are building a web application that would use the following technologies:
1) Spring
2) Hibernate
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?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

It's not just the number of users that matters. How often are they doing things? What do they do (read vs update)? How many are concurrent? etc.

There are a few general pieces of advice:
  • cache read only data if you can
  • don't put too much in the session - memory constraints
  • make sure you don't rely on there being only one JVM in case you need to add clones later
  • performance test early - you don't have to be done to test one function to make sure it is architecturally scalable

  • [OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
    Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
    Tim Holloway
    Saloon Keeper

    Joined: Jun 25, 2001
    Posts: 17417

    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.
    manuel aldana
    Ranch Hand

    Joined: Dec 29, 2005
    Posts: 308
    these 100K+ users, how many of them are supposed to use the site concurrently? what state does the application have? how distributed are the users (just one country, worldwide)?

    For general hints also have a look at: book . It is a bit old (2002) but gives you a good overview on the concepts.

    aldana software engineering blog & .more
    I agree. Here's the link:
    subject: Building a scalable performant web application
    It's not a secret anymore!