Discussions

Performance and scalability: Web Application Without EJBS,How to make it scalable.

  1. Web Application Without EJBS,How to make it scalable. (6 messages)

    Hi,
      I am currently working on a project to create a web application without using EJBs.This application currently runs on tomcat.At the backend i am using a MySQL database.There are a lot inserts that i have to perform.Currently what i have done is,i have written a helper class where i invoke a single method which does all the inserts.I have marked this method as 'Synchronized'.
    I think for a limited number of users this approach might work fine but what if the number of users accessing the web apps is large.Can you please suggest some better approach to handle scalability and also transactions.
    I thought of using JTA but i think with tomcat we need to download some transaction manager to use JTA.
     rajat
  2. You could try using Spring's AOP abilities for transactions.
  3. Thanks for the suggestion,i will try using the spring framework.
  4. If you're just using one resource (database) there is no need to use JTA and/or TransactionManager. Local transactions should do. You can use local transactions manually (connection.setAutoCommit(false), conncetion.commit()/rollback()) or use almost any of the frameworks, including Spring.
  5. Good Database Driver[ Go to top ]

    A good database driver with pooling will solve your issues. It will include transactions and pool your connections.

    If you are opening a single connection and trying to 'pipe' everything through it, you will have problems scaling. This is what pooling is for.
  6. There are a lot inserts that i have to perform.Currently what i have done is,i have written a helper class where i invoke a single method which does all the inserts.I have marked this method as 'Synchronized'.I think for a limited number of users this approach might work fine but what if the number of users accessing the web apps is large.Can you please suggest some better approach to handle scalability and also transactions.

    Of course, you can use no EJB at all and get an scalable application. On the other hand, you should avoid using 'synchronized' to protect the insert operations, because if in the future you need to start a second JVM, this approach is not going to work. The best you can do, is to start a local transaction, perform all the inserts, and then commit. In your specific environment, the database must be the last responsible to guarantee the ACID properties of the transaction, and never the JVM.


    Jose Ramon Huerga
    http://www.terra.es/personal/jrhuerga
  7. Dear Sir,

       I'm doing a ME project "Scalable Transactions for Web Applications in Cloud" I'm using the same concepts of scalable LTMs and TPS. Pls help me how to create scalable LTMs


    Nitin Dhawas