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