aspcompat performance problem

C

Cosmin

I am using aspcompat page attribute in ASP.NET so the com components I call
can get at ASP intrinsic objects (Request, Response, Application, etc)

I have quickly created a new test project, one asp.net page and a vb6 com
component.

The page does this:

for (int i = 0; i < 1000; i++)
Application["string" + i] = i.ToString();
Debug.WriteLine(string.Format("{0} done adding strings to
app",Environment.TickCount));
var asp = new ASPTest.CompClass();
asp.SetProcessId();


Basically I add stuff in the application object and then call the com
component.

Set context = GetObjectContext
If Not context Is Nothing Then
Set app = context("Application")
Set ses = context("Session")
Set resp = context("Response")
If Not app Is Nothing Then
OutputDebugString "" & GetTickCount & " writing response"
resp.Write "I see application from vb <br/>"
OutputDebugString "" & GetTickCount & " before "
For i = 100 To 200
resp.Write GetTickCount & " i = " & app("string" & i) &
"<br/>"
Next
OutputDebugString "" & GetTickCount & " after "
End If
Else
OutputDebugString "No context"
End If


The problem is that the more stuff I put in the application the slower the
vb code becomes. Not all the code though, just when I first try to invoke any
method on intrinsic objects, in my example my first resp.Write call. If I add
10000 items in the app resp.Write takes ten seconds to complete, 60000 =>
timeout. If only 100 items in the App => no delay.

It seems that when I touch any intrinsic object the first time the runtime
does something nasty to make the objects available to COM.

Have you ever seen this? Any suggestion is much appreciated.
 
B

bruce barker

aspcompat incurs large performance problems. it causes all all calls to
an apt com object to be done on a single thread. a special thread is
created to access the apt com objects, and all asp.net requests that
access the com object must use this thread.

in general, apt model com objects (vb6) should never be used with
asp.net. you should host the com objects in com+ (they are still a
performance bottleneck but it may be better).


-- bruce
 
C

Cosmin

Bruce,

I know com interop and aspcompat are slow but that is what I have to do. You
didn't answer my question though. Why is it slow when I access the first time
an intrinsic object from the COM component? From what you describe it should
be slow when I access the com object from the asp.net page, which is not the
case.
 
B

bruce barker

..net objects (even strings) are not com objects. GetObjectContext has
to build and compile a com wrapper for any objects contained by the
intrinsic objects. the more strings you stuff in application, the more
more com wrapper objects needed (one per string).


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top