Results 1 to 2 of 2

Thread: Parallel DAO Acces

  1. #1
    Join Date
    Jun 2008
    Posts
    10

    Default Parallel DAO Acces

    Hello,

    I'm using Spring with a layered architecture ie
    - I have at the bottom a DAO layer containing all my DAO bean to access database,
    - I have upon that a service layer for the treatment stuff and that uses the DAO bean to access database.

    One of my service bean calls 3 DAO beans to get back data and then do some treatment to present data to the view layer.
    The call of each DAO takes between 2 and 4 seconds. The calls are not simultaneous, so the total DAO call is between 9 and 12 seconds.
    The DAO could be called independently.

    Is there a simple way to call my DAO in parallel to obtain a global time of call equals to 4 sec ?
    Is the use of thread the solution ?

    Thank's,

  2. #2
    Join Date
    Jan 2008
    Location
    San Diego
    Posts
    780

    Default

    Sounds like your problem is not the need for parallelism in your dao calls, it sounds like your problem is in your schema. What is the query that your dao runs that is taking 4 seconds? Do you have the appropriate indexes on your talbes? Have you tried analyzing your queries in a query analyzer to see what is taking so long (if it is doing a table scan, that is BAD)?

    How are your dao's built? Are you using spring dao support? Manually constructing your queries with simple JDBC statements? Using prepared statements? How is your datasource configured? What kind of datasource are you using (pooled?)?

    Finally, how many rows are being returned by your queries? If you are fetching tens of thousands of rows and these rows all have to be marshalled into pojo's, this is going to take some time regardless, due to network and marshalling overhead.

    IOW, you need to profile the application and find out WHAT is the bottleneck before you go off half cocked and entertain adding concurrency to your dao execution. The problem may be very simple to fix.

Posting Permissions

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