threading in BEA weblogic5.1

Discussions

EJB programming & troubleshooting: threading in BEA weblogic5.1

  1. threading in BEA weblogic5.1 (8 messages)

    Hi,
       I have a situation here. We are developing a search application. As per the specifications, the user enters a criteria like part number, manufacturer code etc. The application displays 250 results (thats the max limit), 25 per each page. The current application takes 600 milliseconds to retrieve 250 results to the front end with 500 users. We are using BEA weblogic5.1 application server.
    We are using a DAO(JDBC) to retrieve the results. The results are set in the session as 250 value objects.
    Users want the search to be faster.
    We found that instantiating the 250 objects is the bottleneck. So, this is what we are trying to do: When the trader enters the criteria and hits the search button, the servlet starts a thread. This thread retrieves 25 records, instantitates 25 value objects and starts a new thread. The 25 records are displayed to the user, meanwhile the second thread searches the remaining 225 results, instantiates 225 value object and adds them to the session.
    Do you see anything wrong in this approach?
    Thanx
    Bharat

    Threaded Messages (8)

  2. threading in BEA weblogic5.1[ Go to top ]

    "So, this is what we are trying to do: When the trader enters the criteria and hits the search button, the servlet starts a thread. This thread retrieves 25 records, instantitates 25 value objects and starts a new thread. The 25 records are displayed to the user, meanwhile the second thread searches the remaining 225 results, instantiates 225 value object and adds them to the session. "

    To me, that idea sounds fairly good. Here are some thoughts:

    1) BEA recommends not doing any multithreading inside beans. Not sure if this applies

    2) I'm not sure why retrieving 250 rows is a bottleneck; I question that. I'm hitting a remote database on my local wls 5.1 and I can retrieve 1200 and it's basically instantaneous.

    3) I'm using a similar architectural technique(dao/valueo bject) but I'm only storing a List of database keys (a wrapper around 'long') and not an entire value object. To me, this solution is far more scalable than what you talk about, because this site we have could potentially have many users out there with fairly large resultsets in them, and all I'm storing is a List of 4-byte values whereas you're storing large List's of objects probably at least 1024 (I'm guessing; most objects aren't smaller than that). As a page displays, I hit the database using a 'fast-lane access' technique to display that particular set of database records via value objects.

    This approach seems to be working very, very well for us. Good luck.
  3. threading in BEA weblogic5.1[ Go to top ]

    2) I'm not sure why retrieving 250 rows is a bottleneck; I question that. I'm hitting a remote database on my local wls 5.1 and I can retrieve 1200 and it's basically instantaneous.


    We did use the optimization tools to find the bottlenecks. retrieving the 250 records from the database is not the bottleneck. After retrieving the results from the database, we are instantiating the value objects, invoking the setters on the value objects to set the values from the resultset. This part is the bottle neck.

    >>>3) I'm using a similar architectural technique(dao/valueo bject) but I'm only storing a List of database keys (a wrapper around 'long') and not an entire value object. To me, this solution is far more scalable than what you talk about, because this site we have could potentially have many users out there with fairly large resultsets in them, and all I'm storing is a List of 4-byte values whereas you're storing large List's of objects probably at least 1024 (I'm guessing; most objects aren't smaller than that). As a page displays, I hit the database using a 'fast-lane access' technique to display that particular set of database records via value objects.

    I dunno about the fast-lane access. Are you hitting the database from the front-end jsp?
  4. threading in BEA weblogic5.1[ Go to top ]

    "We did use the optimization tools to find the bottlenecks. retrieving the 250 records from the database is not the bottleneck. After retrieving the results from the database, we are instantiating the value objects, invoking the setters on the value objects to set the values from the resultset. This part is the bottle neck.
    "

    Yes, but using the transitive property, I said I can't imagine pulling 250 records being the bottleneck; you then said populating 250 objects is a bottleneck. If I though pulling 250 records from a database wouldn't be the bottleneck, do you think I would feel like populating 250 objects would be? That's even more unbelievable. I'd put some display statement before and after the object population; don't believe the tool on that one. That should NOT be a bottleneck unless you're doing something crazy or a lot of intense reflection.

    "I dunno about the fast-lane access. Are you hitting the database from the front-end jsp? "

    http://java.sun.com/blueprints/patterns/j2ee_patterns/fast_lane_reader/

    Basically, Sun's way of telling you not to use EJB's all the time :)
  5. threading in BEA weblogic5.1[ Go to top ]

    "Are you hitting the database from the front-end jsp? "

    Lol
  6. threading in BEA weblogic5.1[ Go to top ]

    250 objects * 500 users is potentially a lot of object creation/destruction. As suggested earlier look at object pooling
  7. threading in BEA weblogic5.1[ Go to top ]

    "250 objects * 500 users is potentially a lot of object creation/destruction. As suggested earlier look at object pooling "

    That was my point... but I didn't suggest pooling. I doubt that would work in the scenario he's describing; I know it wouldn't in ours. Besides what I did works great... 500 users would be nothing.
  8. threading in BEA weblogic5.1[ Go to top ]

    How about object pooling?
  9. threading in BEA weblogic5.1[ Go to top ]

    Object pooling?? For database records?