File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Scalability of JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Scalability of JSP" Watch "Scalability of JSP" New topic

Scalability of JSP

amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231

What are factors which affect the scalability of JSP page?
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by amit sanghai:
What are factors which affect the scalability of JSP page?

A simple question but it jumps into a whole pit full of snakes. Typically a web application consists of multiple logical layers (JSP/presentation, application server, database) and physical components (networks, routers, machines, storage). Scalability issues can arise in all of them, and the whole is no stronger than the weakest link.
JSPs, by and of themselves, are very scalable. They are multithreaded (unless you implement SingleThreadModel), can therefore be used by many clients simultaneously, and hold no state and can therefore be replicated at will.
Now if that were all, scalability would be near-perfect as you can simply fling more machines at a problem when necessary. But you will generally want to maintain some kind of client state somewhere (user profile, site content...). Typically, temporary state goes into your session object, the rest into a database back-end.
Scalability, then, is first and foremost determined by the application server and the database plus the hardware that supports them.
If a single application server instance can no longer handle the load, you either need a server that will share session information across multiple machines, or need a load balancing set-up that will redirect clients to the same server for every request.
Database access can have a major impact on scalability. If you are setting up JDBC connections in your JSP, that is going to severely limit your scalability -- always use a connection pool (either accessed directly from the JSPs/servlets/beans or indirectly via EJBs). If the database layer itself runs into scalability problems, think about replicating static or near-static data into multiple databases and splitting up your dynamic data across volumes or even machines.
Does that answer your question?
- Peter
I agree. Here's the link:
subject: Scalability of JSP
It's not a secret anymore!