Monday, February 25, 2008

cwbx info on connection pooling

Well, I talked on the phone with IBM's .net Support. And the cwbx definitely does not do any kind of pooling. It's a batch/queue setup. So multiple calls into the dll will stack up one after the other until they are all done.

To get around this I created a simple Object Pool, that would instanciate the object's connection to the 400, and then when I need the object, get it from the pool, use it and return it. Pretty slick!

As for the connecitons on the 400, they just sit in a status of TIMW until they are used. I do have a limit on the number of connections in the pool, so if I get too many in there, I close the oldest one down.


Anonymous said...

Hello ; im in deep trouble with cwbx connection pooling. I wrote a c# client program for calling as400 programs. But i cant get around this problem of just calling one program at a time. Can you help me with this please?

Mike said...

I found some generic code to help me with it. You have to create an object pool. Then when you make a request to the call, the pool will hand you an object, either a new connection or one of the available ones.

Then calling into the pool, you can have as many connections as you need. I heavily modified this version for our stuff: C# Object Pooling

Mike said...

For the record though, we actually dropped the object pooling stuff. It worked good, but we found another product that does it all for us, ASNA DataGate

Their stuff when installed on the 400, handles all the connection pooling, manages the user connections on the 400 and does one more thing that I wasn't able to figure out: How to run the programs in batch mode.

Even though I was pooling all the objects, on the 400, I noticed that even with multiple connections, it was still only running one of the programs at a time. With DataGate, calling the same program, I could see the 400 run that program multiple times at the same time.