3 Replies Latest reply on Sep 16, 2009 11:09 AM by Peter Johnson

    Scaling of a Seam app

    Perez Fokker Newbie

      Hello all,

      I have experience in developing web applications with php and javascript for 10 years and have also 7 years of java experience.

      Now I made my way to the JEE world and my interest is creation of scalable applications based on this technology.

      I have developed a rather simple blog-like web application based on Seam 2.1 and RichFaces. General functions are viewing of a page, post a comment and do search. The output structure is highly dynamic i.e. 90% of HTML content is generated based on user input (not much to cache?). We have also an extensive usage of the reRender RichFaces property where it makes sense. We run JBoss 5.0.1 with mod_jk and Apache.

      Now I want to proceed with a scaling step and I have thousands of questions, also regarding the system setup.

      What we got now is a test system with 1 SATA drive, dual core CPU (2 Ghz) and 3GB of RAM; the DB system is MySQL. I have done some load tests using the linux tool 'siege' which pulls only a certain url and the cookie but not all the static content. I have for example concurrency problems with a limit to something between 2 and 8 concurrent users.

      My general questions are:

      - what would be the typical maximum request rate for this hardware configuration if using the described components? When should I think of a server with e.g. 4 or 8 GB RAM or additional machines for the database or for a clustering solution? First of all, which concurrency rates should be "normal" for what configuration?

      - by tuning transaction isolation it seems rather hard to tune the server in a way so that there are no concurrency conflicts even on incrementing an item counter. What do you do, guys, to avoid that?? (or is that a question to Hibernate community?)

      - after a level of concurrent requests exceeding 10 or 15 the server gives up, saying "cannot open jdbc connection" and does not recover from this state. Tuning db pool size does not help.

      - does it make sense to upgrade to JBoss 5.1.0, Seam 2.2 and also JVM 6? (I mean, many folks are still happily running JBoss 4 and JVM 1.4 or not?)

      - what books or tutorials are known to give an extensive assistance to these topics?

      thank you very much in advance

        • 1. Re: Scaling of a Seam app
          Peter Johnson Master

          1) That all depends on your app, how it is written, what it does, and the types of user and database interactions expected. Using similar hardware and running some standard benchmarking apps we have gotten a few hundred concurrent requests, and thus several thousand simulated active users.

          2) What transaction isolation level are you using? From my understanding (I am by no means a Hibernate expert) Hibernate prefers more lenient levels and works best with optimistic locking. (And yes, this is probably a question better asked to the Hibernate community.)

          3) What min and max pool sizes did you specify in the *-ds.xml file? The default is 20.

          4) There are those that would advocate moving from 5.0.1 to 5.1.0 just to get the bug fixes, but if you have a running system, why switch? (I doubt that the issues you are facing would go away.)

          5) Most of you questions are database connection related, so I suspect that a Hibernate book or the Hibernate forum might be a good resource. What database are you using? A presentation on scaling Hibernate application using PostgreSQL was given at the recent JBossWorld.

          • 2. Re: Scaling of a Seam app
            Perez Fokker Newbie

            Hello PeterJ,

            thank you very much for the quick reply and your advice!

            "PeterJ" wrote:

            1) ... some standard benchmarking apps


            are there specific benchmarking tools for Seam/RichFaces? which would you recommend?

            "PeterJ" wrote:

            2) What transaction isolation level are you using? ... best with optimistic locking.


            I have tried the setting 2 and versioning. Optimistic locking causes lost clicks of the item counter through overwriting.. Well, I should go with it to the Hibernate folks. But I have a feeling that my transactions (which equals in a default setup to a page load?) take too much time, therefore the conflicts.

            "PeterJ" wrote:

            3) What min and max pool sizes did you specify in the *-ds.xml file? The default is 20.

            I have tried different settings, from more than 20 to hundreds which I do not think to be optimal?.. Btw I used c3p0 settings in the persistence.xml

            "PeterJ" wrote:

            5) What database are you using?


            MySQL 5.1.; do I need InnoDB tables if using versioning?

            kind regards

            • 3. Re: Scaling of a Seam app
              Peter Johnson Master

              1) None that I know of. You'll have to roll your own load tests.

              2) Hmm, "setting 2 and versioning" was not the kind of answer I expected, are these Hibernate terms? I was wanting to know what isolation level was mentioned in *-ds.xml, which would be something like TRANSACTION_READ_COMMITTED.

              3) Oh, you are using MySQL - now the 15 connections rings a bell! In a default installation (at least on Windows, don't have access to my Linux box just now), MySQL allows a max of 15 connections. Edit the max_connections value in the mysql config file.

              Also, have you checked with mysql as to how many connections are in use, and use the jmx console to see how many connections JBoss AS has established?

              5) I always use InnoDB - it is the only data engine that provides ACID properties. The myisam engine requires the entire table to be locked to ensure transactional writes (or at least that is my understanding). myisam is great if you will load the database with data in a batch operation and from then on will only read the data. For anything else use innodb.