What is the correct abstraction??

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the correct abstraction??

Jeff Gortatowsky
So being a newbie to this, lets say I have

class userService {
static expose = ['cxf']
static exclude = [blah blah[

// Exposed SOAP service call
UserLotsOfInformation getLotsOfUserInfo(userid) {
     UserInfo ui = getLotsOfDbStuff(userid)
     UserMoreInfo mi = getLotsMoreDBStuff(userid)
     new UserLotsOfInformation(ui, mi)
}

// Non-exposed service methods
UserInfo getLotsOfDbStuff(userid) {
  ///long DB query 1
}

UserMoreInfo getLotsMoreDBStuff(userid) {
  ///long DB query 2
}



This works just fine in grails. Very neat. Very few lines of code. I have a couple more calls, but this is the idea. So right now it takes the sum of the times to service this.

So now I want to run these in parallel so as to incur only the longest running call, not the sum (and maybe some overhead) and wait for them to complete, join up the data, and move along. The remote call to this service is still synchronous.

This is really my use case. It's not the type of problem where groovy's internal locking problems and such are like to trip me up. (I hope)
Madness?
Just looking for ideas as I go read the latest docs...

Best wishes
Jeff

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: What is the correct abstraction??

Vaclav
Administrator
Hi Jeff,

just as you say this should be a very good usecase for GPars. Since each concurrent call will most likely spend most of its time in the db, scalability will be more influenced by the db implementation than by the Groovy MOP synchronization issue.

Cheers,

Vaclav



On Mon, Dec 21, 2009 at 2:13 AM, Jeff Gortatowsky <[hidden email]> wrote:
So being a newbie to this, lets say I have

class userService {
static expose = ['cxf']
static exclude = [blah blah[

// Exposed SOAP service call
UserLotsOfInformation getLotsOfUserInfo(userid) {
    UserInfo ui = getLotsOfDbStuff(userid)
    UserMoreInfo mi = getLotsMoreDBStuff(userid)
    new UserLotsOfInformation(ui, mi)
}

// Non-exposed service methods
UserInfo getLotsOfDbStuff(userid) {
 ///long DB query 1
}

UserMoreInfo getLotsMoreDBStuff(userid) {
 ///long DB query 2
}



This works just fine in grails. Very neat. Very few lines of code. I have a couple more calls, but this is the idea. So right now it takes the sum of the times to service this.

So now I want to run these in parallel so as to incur only the longest running call, not the sum (and maybe some overhead) and wait for them to complete, join up the data, and move along. The remote call to this service is still synchronous.

This is really my use case. It's not the type of problem where groovy's internal locking problems and such are like to trip me up. (I hope)
Madness?
Just looking for ideas as I go read the latest docs...

Best wishes
Jeff

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech