Groups | Blog | Home
all groups > inetserver asp components > november 2004 >

inetserver asp components : COM+/OLEDB connection pooling query for ASP component


Richard Hollis
11/6/2004 5:41:16 PM


I have a C++ control, which I have developed, which is used to render the
key part of most pages pages across my site. It is used on almost every
page and there is anything from 1-4 objects that belong to the control used
on various pages. I've been trying to get the rendering time of the pages to
be as fast as possible, but I just don't seem to be able to get it to what I
think I should be able to.



One particular page, that is larger than most, but also one of the most
frequently used, has page load times in the region of 0.7, on average. This
can be slightly lower and even higher in the 2-3 seconds sometimes. The ASP
page loads the control, which then opens an ADO connection (or recordset) to
execute the required stored proc and get the data back to render. I believe
one of the problems I have is that the COM object is not cached so that
everytime the page is loaded the control is loaded too. The other problem
is the time it takes to open a connection to the database is very costly.
I've read a lot in the past few days about performance, OLEDB connection
pooling and also COM+ object pooling and I think that I should be able to
get a sizeable performance gain if I get the pooling right? I'm really not
sure that my control is using OLEDB connection pooling because of the time
it takes to open the connection, it may be getting it, I just seems like it
takes too long. Do controls running under ASP/IIS get to take part in
connection pooling? I've also tried opening one ADO connection per page and
sharing that amongst my different objects, but that didn't really seem to
improve performance either.



I've also tried adding the COM+ object pooling methods and IObjectControl
interface to the objects but this didn't seem to make any difference. I
later read that COM+ will actually perform some pooling of objects without
these methods anyway. I noticed that you couldn't enable Object Pooling in
the Component Manager unless your control was marked Neutral. Now, I'm not
totally sure what I would need to do to convert my control from STA to
Neutral - I'm not using any threads in the control - but I was interested to
see what difference turning on the pooling would make, so I changed the type
to Neural and tried it out. The pages then seemed to load even slower - 2-6
seconds each time. I found that where the objects were being re-used that I
had to call my Clear method each time I started to use the object, even
though the page had created a fresh instance, it still had the data from the
previous page request in the object - which makes sense if it is reusing the
controls objects from a pool. Like I said though, I just did this out of
curiosity, I don't proclaim to know all the right steps to do the Neutral
type at this time. I may have broken the rules of Neutral controls in doing
this and this could well explain the low performance.



Should I use COM+ object pooling and handle the pooling of connections to
ADO myself or do I avoid COM+ object pooling totally and take another route?



I would be grateful for any pointers, advice or suggestions.



Thanks

Richard





Richard Hollis
11/8/2004 8:49:21 PM
I found the problem. I had a few on Friday, but more to the point the
strange loading times is down to the first few objects being created and
placed in the pool.


[quoted text, click to view]

AddThis Social Bookmark Button