Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > speed problem using smart pointers on FPC.Root
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 15th April 22:31
alni
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root



Hi,

I've a little speed problem while browsing destinations sets. It tooks
about 8" to browse a full 1024 destinations set. It's not a network
problem, because I got also large execution time when running on the ISA
server (4" : +-1000 entries/second).
It's a problem, because I plane to use destinations sets that contains
more than 450 000 entries so it could take more than an hour to export
the entiere content.

Is there any way to speed up the thing ?
When using ISA mmc, it takes not such time to retrieve the destination
sets content even from a distant machine.
Maybe the smart pointers are not the right way.

I connect to the ISA using CoInitializeEx(), using "localhost" as target
when running on the ISA.

nb: Because of the bug on the long result for fpcDestinationSet->Count
discuted a few days ago, I can't know the count for a Set, so, I'm using
an infinite loop incrementing the variable "l" until falling in
exception catched by the try/catch couple when reaching the end.

Thanks for help.

-------------------------------------

FpcDestinationAddressType Dtype ;
long l = 1;
CString Buff;

try {
while (fpcDestination = fpcDestinationSet->Item
(_variant_t(l),(BSTR) NULL ,(BSTR) NULL)){

fpcDestination->get_Type( &Dtype );

Dtype=fpcDestination->Type;

switch ( Dtype ){
case 0 :
Buff=(char*) fpcDestination->DomainName;
break;
case 1 :
Buff= (char*) fpcDestination->IP_From;
break;
case 2:
break;
default :
break;

}
Buff.TrimRight();
Buff.TrimLeft();

//here : storing Buff in a file but commented while testing speed

l++;
}
}catch ( _com_error& pCE ){
}
  Reply With Quote


  sponsored links


2 15th April 22:32
v-wzhang
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root



Hi Alni,

I have been looking into this issue and will update you with my
result. Please wait for my message. Thanks.

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - http://www.microsoft.com/security
  Reply With Quote
3 15th April 22:32
alni
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Bonjour,

"WenJun Zhang[msft]" <v-wzhang@online.microsoft.com> a écrit :


Yes, of course, I know. Thanks again for that.

But at this point, I just wonder if I should consider as "normal", that
it takes more than 4" to browse 1000 destinations using my code. May be
there is an other way.
Because I'm planning to use destinations sets of about half a million
destinations. So it could take more than 4*500=2000". More than 1/h hour
to retrieve the set to a file !!!
Such a file that contains 500 000 entries weigh 8Mo, so the "write to
file" time should be negligible.
On the other side, using ISA management MMC, it takes about 5" to fill
the list box that contains the 500 000 entries set (even on a distant
machine). That's why, I wonder....


Regards,
  Reply With Quote
4 15th April 22:32
v-wzhang
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Hi Alni,

I also met the C2556 and C2371 errors on GetType(). I wonder how you
finally worked around it?

error C2556: 'GetType' : overloaded functions only differ by return
type
error C2371: 'GetType' : redefinition; different basic types

At least the low performance shouldn't be caused by FPC. I tested
going through 1024 items destination set in vbs. It definitely
needn't 1 sec to finish. So I do think the problem is in the VC code.

Dim objFPC
Dim fpcDestinationSets
Dim fpcDestinationSet
Dim objFPCArray
Dim fpcDestination
Dim temp

Set objFPC = CreateObject("FPC.Root")
Set objFPCArray = objFPC.Arrays(1)
Set fpcDestinationSets = objFPCArray.PolicyElements.DestinationSets
set fpcDestinationSet= fpcDestinationSets("test")

for each fpcDestination in fpcDestinationSet

'Wscript.echo fpcDestination.type

Select Case fpcDestination.type
Case 0
'Wscript.echo fpcDestination.domainname
temp = fpcDestination.domainname

Case 1
'Wscript.echo fpcDestination.Ip_From
temp = fpcDestination.Ip_From
Case 2

End Select

'Wscript.echo

next

Wscript.echo temp

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - http://www.microsoft.com/security
  Reply With Quote
5 15th April 22:32
alni
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Hi,

"WenJun Zhang[msft]" <v-wzhang@online.microsoft.com> a écrit :


There is an enum "type" for the return value
http://msdn.microsoft.com/library/en-us/isa/isaenum_9ecl.asp

So :

FpcDestinationAddressType Dtype ;
long l=1;
try {
while (fpcDestination = fpcDestinationSet->Item
(_variant_t(l),(BSTR) NULL ,(BSTR) NULL)){

Dtype=fpcDestination->Type;
// or fpcDestination->get_Type( &Dtype );

switch ( Dtype ){
case 0 :
Buff=(char*) fpcDestination->DomainName;
break;
case 1 :
Buff= (char*) fpcDestination->IP_From;
break;
default :
break;

}
...../....
l++
}
}catch ( _com_error& pCE ){
Display.Format("Failed: %x, source %s\n", pCE.Error, (char*)
pCE.Source());
// MessageBox(Display);
}


Using CoCreateInstanceEx() ?
In order to use my prog from a distant machine, I have to use this
method.

Of course when I use hr = fpcRoot.CreateInstance("FPC.Root")
and run the exe on the ISA itself, I've no speed problem at all

Looking at the task manager of the ISA while running the 2 methods, I
can observe that
- CoCreateInstanceEx()uses a dllhost.dll on the ISA that grows up to 300
Mo when using my huge destination set (470000 entries). The process is
slow as I said previously, even if I run from the ISA specifying
localhost as target.
- fpcRoot.CreateInstance("FPC.Root") runs on the ISA itself and is very
fast (also less than less than 1" to complete the export 1000 items
destination set. In that case, there is no dllhost that appears, but my
prg itself grows up to 300Mo when playing with the huge set.

But for now, I've removed the huge set, I run my test ISA server in a
vmware and my computer is only 512Mo RAM, so this huge set was causing
lots of swap on the VM and on my computer

What's happen if you use :
Set objFPC = CreateObject("FPC.Root", "YourISAServer")

from your ISA and eventually from a distant machine ?

I suppose that vbs translate : CreateObject("FPC.Root")
by fpcRoot.CreateInstance("FPC.Root") (whih is fast for me)
but I wonder how it will translate :
CreateObject("FPC.Root", "YourISAServer") and if it cause speeds
problems

If I've a little time I will try to use your script using this method.

Regards,
  Reply With Quote
6 15th April 22:32
v-wzhang
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Hi Alni,

I'm not testing on a distant machine. Locally test the following two
lines and their performance appears to be no difference.

Set objFPC = CreateObject("FPC.Root")

Set objFPC = CreateObject("FPC.Root", "YourISAServer")

Have you got a work around of the huge set yet? :-)

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - http://www.microsoft.com/security
  Reply With Quote
7 15th April 22:32
alni
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Bonjour,

"WenJun Zhang[msft]" <v-wzhang@online.microsoft.com> a écrit :


While not fixed, I'm using endless loops between try/catch couples
-----------------------------------------
l=1;
FpcDestinationAddressType Dtype ;
try {
while (fpcDestination = fpcDestinationSet->Item
(_variant_t(l),(BSTR) NULL ,(BSTR) NULL)){

fpcDestination->get_Type( &Dtype );

Dtype=fpcDestination->Type;

switch ( Dtype ){
case 0 :
Buff=(char*) fpcDestination->DomainName;
break;
case 1 :
Buff= (char*) fpcDestination->IP_From;
break;
case 2:
break;
default :
break;

}

Buff.TrimRight();
Buff.TrimLeft();
Buff+="\n";
File.WriteString(Buff);

l++;
}

}catch ( _com_error& pCE ){
TRACE("Failed: %x, source %s\n", pCE.Error, (char*) pCE.Source());
}

When the program reach the end of the set, it falls in the catch....
I've just put a TRACE in order to prevent compilation warning if pCE is
not used.

Regards
  Reply With Quote
8 15th April 22:32
v-wzhang
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Hi Alni,

I'm still not able to get rid of the C2556 and C2371 error. Reduced
the code as below and the error still occurs. Could you provide the
your modified code with the error worked around? Probabaly I'd file
another ISA SE bug about the FpcDestinationAddressType GetType
redefinition.

I haven't found where can cause the endless loop. Will you still get
into the loop with the following reduced code?

#define UNICODE
#define INITGUID
#define _WIN32_WINNT 0x0400
#include <Afx.h>
#include <windows.h>
#include <stdio.h>
#include <objbase.h>
#import "C:\Program Files\Microsoft ISA Server\msfpccom.dll"

int main (int argc, WCHAR **argv)
{
DWORD dwRet = 0;
HRESULT hr = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED );

FPCLib::IFPCPtr fpcRoot;
FPCLib::IFPCArraysPtr fpcArrays;
FPCLib::IFPCArrayPtr fpcArray;
FPCLib::IFPCDestinationSetPtr fpcDestinationSet;
FPCLib::IFPCDestinationPtr fpcDestination;

hr = fpcRoot.CreateInstance("FPC.Root");
if (FAILED (hr))
{
printf ("Failed: %x\n", hr);
return dwRet;
}
try
{
fpcArrays = fpcRoot->Arrays;
long v1 = 1;

if ( fpcArrays->Item (_variant_t(v1)) == NULL )
return dwRet;

fpcArray = fpcArrays->Item (_variant_t(v1)) ;

fpcDestinationSet=fpcArray->PolicyElements->DestinationSets->Item(_var
iant_t(v1)) ;


FPCLib::FpcDestinationAddressType Dtype ;
CString Buff;
long l = 1;

try {
while (fpcDestination = fpcDestinationSet->Item
(_variant_t(l),(BSTR) NULL ,(BSTR) NULL)){

fpcDestination->get_Type( &Dtype );
Dtype=fpcDestination->Type;

switch ( Dtype ){
case 0 :
Buff=(char*) fpcDestination->DomainName;
printf ("Destination domain name: %s\n", Buff);
break;
case 1 :
Buff= (char*) fpcDestination->IP_From;
printf ("Destination IP from: %s\n", Buff);
break;
case 2:
break;
default :
break;

}

l++;
}
}
catch ( _com_error& pCE ){
printf ("Failed: %x, source %s\n", pCE.Error, (char*)
pCE.Source());
}


}
catch (_com_error& pCE)
{
printf ("Failed: %x, source %s\n", pCE.Error, (char*)
pCE.Source());
}
dwRet = 1; // Ok.

CoUninitialize();
return dwRet;
}


Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - http://www.microsoft.com/security
  Reply With Quote
9 15th April 22:32
alni
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Bonjour,

"WenJun Zhang[msft]" <v-wzhang@online.microsoft.com> a écrit :

I use "using namespace FPCLib;" directive, then I declare :
IFPCPtr fpcRoot;
IFPCArraysPtr fpcArrays;
IFPCArrayPtr fpcArray;
IFPCDestinationSetPtr fpcDestinationSet;
IFPCDestinationPtr fpcDestination;

FpcDestinationAddressType Dtype;

That works this way.


This is part of my OnExport() function.
When the counter "l" reach the end of the set+1, this line fails :
while(fpcDestination = fpcDestinationSet->Item())
So the program jumps to the catch line...

---------------------------------------------------
l=1;
FpcDestinationAddressType Dtype ;
try {
while (fpcDestination = fpcDestinationSet->Item
(_variant_t(l),(BSTR) NULL ,(BSTR) NULL)){

if (l%100==0)
{
m_Status.Format("Export in progress... Count : %8ld",l);
UpdateData(FALSE);
UpdateWindow();
}

fpcDestination->get_Type( &Dtype );

Dtype=fpcDestination->Type;

switch ( Dtype ){
case 0 :
Buff=(char*) fpcDestination->DomainName;
break;
case 1 :
Buff= (char*) fpcDestination->IP_From;
break;
case 2:
break;
default :
break;

}

Buff.TrimRight();
Buff.TrimLeft();
Buff+="\n";
File.WriteString(Buff);

l++;
}

}catch ( _com_error& pCE ){
TRACE("Failed: %x, source %s\n", pCE.Error, (char*) pCE.Source());
}
m_Status="Export completed.";
  Reply With Quote
10 15th April 22:33
v-wzhang
External User
 
Posts: 1
Default speed problem using smart pointers on FPC.Root


Hi Alni,

I'm still researching this issue and will update you as soon as I get
more information on it. Please wait for my message. Thanks.

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - http://www.microsoft.com/security
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666