Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: seperation of process

  1. #1

    Default seperation of process

    Hi,
    I have an application using Struts, Spring and Hibernate. My hibernate's session factory is a, expensive object and it takes a long time to load the factory. This is affecting the Application startup which cannot be afforded by an application. I want to separate this session factory loading from the main application startup and the application server startup.

    Please suggest me of how to go about for the same.

    Thanks in Advance,
    Sudha

  2. #2
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    I really do not see big sense in such separation - anyway you application likely will be unusable till initialization of session factory completes.

    And what is "long"? 20 seconds, 30 seconds? It is very unlikely, that it takes much more. Why it can not be tolerated once, when application is loaded by application server? How often it occurs (in the production environment)? Once a day? Or even more seldom.

    Or do you instantiate session factory for each user session?`If so, then it is design bug and you should use single instance of session factory for the whole application.

    Regards,
    Oleksandr

    Quote Originally Posted by sudha_parimala View Post
    Hi,
    I have an application using Struts, Spring and Hibernate. My hibernate's session factory is a, expensive object and it takes a long time to load the factory. This is affecting the Application startup which cannot be afforded by an application. I want to separate this session factory loading from the main application startup and the application server startup.

    Please suggest me of how to go about for the same.

    Thanks in Advance,
    Sudha

  3. #3
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Yeah this does sound strange. My application takes 20 seconds to start, not really much of a problem. What's the exact problem you have with this?
    Last edited by karldmoore; Aug 27th, 2007 at 03:50 PM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  4. #4
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote Originally Posted by karldmoore View Post
    Yeah this does sound strange. My application takes 20 seconds to start, not really much of a problem. What's the exact problem you have with this?
    And "exact problem" means "quantified problem", i. e. my application starts XXX seconds (minutes, hours, days ), but maximum tolerable startup time is XX seconds. And I have found that from XXX seconds YYY are spend for SessionFactory initialization Not just I guess that SessionFactory munches the lion part of it.

    Regards,
    Oleksandr

  5. #5

    Default

    Only the part of an application is using these technologies. We have a huge database for the hibernate OR mapping. The base application doesn't use any OR mapping stuff and that's straight forward. This part occupies the major part of an application. Spring, Hibernate is used only in a part of application.

    Whenever the application restarts ( this happens more often) i don't want the sessionfactory to be loaded every time.

    pls let me know if any more clarifications ore needed.

    Note: The startup takes 10-15 minutes.

    Sudha

  6. #6
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by sudha_parimala View Post
    The startup takes 10-15 minutes.
    Wooohooo! However you have achieved that!?

    What about just lazy-loading it - and of course any object that references it as well?

    Jörg

  7. #7

    Default

    Yeah, currently doing the same... But i also want to give an alternative as Loading the whole stuff outside the application server and accessing it with some service locator

    Guys, this is really important for me.. Looking forward for ur suggetions.


    Sudha

  8. #8
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    I might be wrong, but I would attack the actual problem. 10 to 15 minutes is WAY too much for me even with a huge database.

    Jörg

  9. #9

    Default

    Hmmm, I would like to do the same.....
    I 'll give u info about our data model may be u can give me some pointers of how to go about this.

    Our data model is having around 2000+ tables. the associations are also closely knitted. For some reasons i must do the entire data loading with which i can't avoid any objects..... is there a way we can dynamically load the objects only on demand and the same for the the associated objects also...

    Sudha

  10. #10
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote Originally Posted by sudha_parimala View Post
    ...
    Note: The startup takes 10-15 minutes.

    Sudha
    And how much of that time is eaten by session factory creation?

    BTW, creation of session factory does not load any objects from DB, so if your concern is time needed to load your data, then isolation of session factory creation would not help.

    As well 2000 tables in DB sounds way to many. It may not be said for sure without knowing the tasks, but I'm strong feelings that DB is badly misdesigned.

    For some reasons i must do the entire data loading with which i can't avoid any objects.....
    What exactly you mean? Do you load the whole DB (i.e. data) in the memory or you are just speaking about loading of Hibernate mappings?

    If former, then it is a heavy misuse of Hibernate application for sure need redesign (or at least tweaking of Hibernate mappings to allow lazy loading of objects, look in Hibernate documentation for details).

    If latter, then you may try to switch from using of Hibernate XML-mappings to annotations (while with your amount of tables and classes it would be a huge task).

    And, BTW, what is behind "...some reasons..."?

    Regards,
    Oleksandr

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •