-
1. Re: Huge Session Size of JBoss Seam example
sean.tozer Jul 14, 2010 12:10 PM (in response to philosoph)It seems to say pretty clearly right in your quoted text what the issue is:
38.27 MB bookingList
38.27 MB hotelSearchThose components are gigantic. Is your app loading far too much data into those results, for some reason?
-
2. Re: Huge Session Size of JBoss Seam example
philosoph Jul 14, 2010 4:03 PM (in response to philosoph)Yes, that is what we figured, too. But we have no clue what we can optimize because we did not make any (!) changes to the offical booking application example. As soon as we log one user in, the session size explodes.
-
3. Re: Huge Session Size of JBoss Seam example
philosoph Jul 15, 2010 4:52 AM (in response to philosoph)Hi there,
just a few more information:
The session size shoots up without even having done a hotel search.
We deployed the booking example on different computers, same results.
We asked friends of us to install it, just to cross-check if we made any mistakes: same result.
Has anyone tested the memory consumption of the example before and got a different result?
While researching we have found two or three forum threads where this phenomenon was discussed, but without finding a solution.
As our application will have to manage hundreds and thousands of concurrent users logged in, we cannot compensate the memory consumption with hardware.
We would really appreciate it, if anyone has a hint.
Thank you!
philosoph
-
4. Re: Huge Session Size of JBoss Seam example
serkan.s.eskici.online.nl Jul 15, 2010 4:18 PM (in response to philosoph)I won't be surprised if the memory consumption becomes huge and huger, since the following classes are all hold in the session:
- BookingListAction
- HotelSearchingAction
- Identity
- User
Both 1) and 2) contain a Datamodel, which is also hold in the session. Thus the search results are in the session !
Bad implementation imho.
-
5. Re: Huge Session Size of JBoss Seam example
philosoph Jul 16, 2010 4:21 AM (in response to philosoph)Thank you for your thoughts on this. But we still cannot understand this behaviour, as we had used the pure example and we did not add any additional data. The session size explodes as soon as the demo user logs in (we did not even execute a search for example).
If we use only the login and remove the HotelSearchAction Class and cleared the main.xhtml from any code, the session size is about 13 kbytes. Fine!
After that, We did some experimenting and changed the HotelSearchAction and the main.xhtml to the following:
HotelSearchAction.java ================= @Stateful @Name("hotelSearch") @Scope(ScopeType.SESSION) @Restrict("#{identity.loggedIn}") public class HotelSearchingAction implements HotelSearching { private String searchString; public String getSearchString() { return searchString; } public void setSearchString(String searchString) { this.searchString = searchString; } @Remove public void destroy() {} } main.xhtml: ======== <div class="section"> <span class="errors"> <h:messages id="messages" globalOnly="true"/> </span> <h1>Search Hotels</h1> <h:form id="searchCriteria"> <fieldset> <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;"/> </fieldset> </h:form> </div>
And here we go again, session size is about 28 Mbyte. Can you give us a further hint how to change the code, if we want to use session scope for the HotelSearchAction. We would like to keep the searchString in the session, for instance.
Thank you very much!
philosoph
-
6. Re: Huge Session Size of JBoss Seam example
serkan.s.eskici.online.nl Jul 16, 2010 3:32 PM (in response to philosoph)Hmmmm...
Have you tried making use of POJO's instead of Stateful EJB's ?
-
7. Re: Huge Session Size of JBoss Seam example
yahawari Jul 17, 2010 10:56 PM (in response to philosoph)did u try to log in with more users and see the session size. a 28 MB could be a one time overhead. what i mean is, log in with 5 users for example and see the total session size, is it 28 x 5 ??
thanks for ur post though!
-
8. Re: Huge Session Size of JBoss Seam example
demetrio812 Jul 18, 2010 11:26 AM (in response to philosoph)Hello,
I recently noticed the same thing while working on a big application with a lot of users.It happens only if I use the entity manager: the more I execute queries the bigger it is (so I suppose it's the Hibernate 1st level cache that contribute a lot).
What I think is that the value is shared among the users. In fact if I see a value of let's say 34MB in one user, analyzing the orther users I find the same value. I made some test and if I load something for a single user MessAdmin seems to calculate the increase for all user session I measure. Also it happened to have, during my tests, 50 session that MessAdmin measured as more then 250MB each and obviously this is impossible even if I set 2GB for the Heap.
So I suppose there is something shared that MessAdmin includes in the calculation of the size.
I still have to find the time to go deep in this topic but I'm glad you opened.
Dem
-
9. Re: Huge Session Size of JBoss Seam example
balazska Oct 18, 2010 7:55 AM (in response to philosoph)Hey, what was the solution?
-
10. Re: Huge Session Size of JBoss Seam example
gonzalad Jan 18, 2011 4:27 PM (in response to philosoph)The solution is don't use MessAdmin :
It computes inaccurately HTTP Session Size for ManagedPersistenceContext.
I've used it today on my application : 10 Mb in each session for ManagedPersistenceContext (and I didn't fetch ANY entity).
So, I use JConsole :
- restart my application.
- create a first HTTP session.
- use JConsole to do a GC, write the heap size on paper (h0).
- create a second HTTP session.
- use JConsole to do a GC, write the heap size on paper (h1).
And h1 - h0 are pretty much the same (and not the 10 Mb from MessAdmin).
I wrote a little helper which serialize all session attributes (using SerializationUtils) and write the total bytes to sysout, call it as a page action (for all view-ids) and find that ManagedPersistenceContext is between 10 and 100 ko.