Eneris Solutions » SEAM PerformanceSeam performance. If you don't know what SEAM is -- then turn around and go back to the technologies pages and start reading...
Now I now what the bogeyman of Seam is – performance. Don't get me wrong... I love Seam. But if you don't THINK about what you are doing, you can really shoot youself in the foot when it comes to performance. If you are just wacking together some little low-volume apps, then you can skip this whole discussion.
EJB3 was designed to be a business layer, with support for transactions, security, etc., etc. When you break down the barrier, or essentially merge, the business logic layer with the presentation layer you should think carefully about what you are doing. Granted that doing so solves the lazy loading problem, but then again, if any of your clients were remote, the lazy-loading couldn't work anyways. Performance killers: facelets, ajax, bi-jection, client-side state, transactions. Oops, I think I listed most of the features of Seam. I tried to re-read all the statements by Gavin King, et. al. And to really read between the lines, because sometimes they are overly polite. It might be easier if they just wrote something like: don't do this, or don't do that. Most importantly, understand that if you are using EJB3 and Seam beans that EVERY SINGLE METHOD CALL must go through the interception chain. These interceptors are where the magic happens, i.e. Bijection, transactions, etc. So here is my list for performance:
I think we have this configured for using one transaction per method call, but there is an extended persistence context. So the objects are managed, i.e. Cached in the persistence context, and then each page refresh (and ajax call) a transaction is started, and then ended after the page is rendered. With seam we can keep the persistence context valid, i.e., the objects are still managed, and then commit changes at the end of a conversation. That allows us to do different things in web requests changing states of objects, but buffer the changes until the commit. Can we get new data during this? How to fix this?
I guess we talk about transactions, to mean exactly the same thing as database session. Back in JDBC days I could open a session, and fetch data without a transaction. Transactions were for changing things. Why is it nowadays, that everything is always a transaction? Confusion about transactions and persistence context – gee I wonder why? Let's see, there seems to be about 8 different ways to do these in SEAM. Use a FLUSH_MANUAL, for those tricky conversations. Will this mean there are only transactions when I want them? Another 'not-talked-about' problem with Seam. The compile-try cycle is very slow. Restarting jboss is slow. This might be the #1 problem nowadays. So either get yourself a big machine, or suffer. You can get a little better turnaround time by using EXPLODE instead of deploy. This way at least if you are only making UI changes (to JSP/JSF) pages you will not need to restart jboss. This is a lifesaver! |