Perfomance problem while passing large data volumes via WMI
From: Stanislav Efremov (hell_at_sw.ru)
Date: 08/18/04
- Next message: Ben Bangham: "Re: Dumb Question"
- Previous message: Alex: "Re: How to call StdRegProv->EnumKey in C++?"
- Next in thread: Ivan Brugiolo [MSFT]: "Re: Perfomance problem while passing large data volumes via WMI"
- Reply: Ivan Brugiolo [MSFT]: "Re: Perfomance problem while passing large data volumes via WMI"
- Messages sorted by: [ date ] [ thread ]
Date: 18 Aug 2004 08:34:24 -0700
Greetings,
I have noticed a perfomance problem while trying to pass large data
through WMI. Suppose we have large file at server side (the size of
the file is about 300 Mb) and we want to pass it to the client side.
Here's my code
unsigned nCount; //size of data
CComVariant varBuf; //CComVariant where we store the data
//fill the variant, nothing of interest here
HRESULT hr;
SAFEARRAY * psaData;
SAFEARRAYBOUND saBound[1];
saBound[0].lLbound = 0;
saBound[0].cElements = nCount;
psaData = SafeArrayCreate(VT_UI1, 1, saBound);
if (!psaData)
{
return E_OUTOFMEMORY;
}
byte *pVarBuf;
hr = SafeArrayAccessData(psaData, (void HUGEP**)&pVarBuf);
if (FAILED(hr))
{
SafeArrayDestroy(psaData);
return hr;
}
//copy stored data to safearray
memcpy(pVarBuf, pBuf, nCount);
SafeArrayUnaccessData(psaData);
varBuf.vt = vt | VT_ARRAY;
varBuf.parray = psaData;
//objects to fill
CComPtr<IWbemClassObject> spOutParams;
CComPtr<IWbemClassObject> spObject;
hr = GetOutParams(&spOutParams, &spObject, pCtx); //fill objects
//put variant to the WMI out-object
//these methods are memory and time consuming.
hr = pObj->Put(L"arrBuf", 0, const_cast<CComVariant*>(&var), 0);
hr = pResponseHandler->Indicate(1, &spOutParams.p);
Well, I do understand that filling the variant this way is not
optimal, but nontheless if we look at my logs:
1) we read and fill CComVariant with data from file rather fast, for
example we read 300Mb file in memory and fill the variant whithin 30
seconds
2) two methods are the most time-consuming, they are
pObj->Put(L"arrBuf", 0, const_cast<CComVariant*>(&var), 0);
and
pResponseHandler->Indicate(1, &spOutParams.p);
These two methods lasts 30 minutes, so the perfomance problem really
exists. Actually there are two processes that are most CPU consuming -
my provider process and svchost.exe which is Windows Management
Instrumentation service. My provider consumes about 1,5 Gb of memory
and about 50% CPU time while passing this data to client. And svchost
also consumes large amount of memory and about 50% of CPU time while
passing data to client. The client-side is OK, there was not any
network drawback while this experiment.
Also I should mention that I can pass rather small files very fast, so
I pass 13Mb file in 1 second and I pass 25Mb file in 3 seconds. So I
think the main drawback is in memory consuming.
My questions are:
1) Why did the WMI process consumes CPU while passing data to client?
2) Why did my provider consumes about 1.5 Gb of memory while passing
data to client? It doesn't use Virtual memory, it tryes to allocate
all available memory instead.
3) What is the best way to pass large data to client.
Thank you in advance,
Stanislav Efremov.
- Next message: Ben Bangham: "Re: Dumb Question"
- Previous message: Alex: "Re: How to call StdRegProv->EnumKey in C++?"
- Next in thread: Ivan Brugiolo [MSFT]: "Re: Perfomance problem while passing large data volumes via WMI"
- Reply: Ivan Brugiolo [MSFT]: "Re: Perfomance problem while passing large data volumes via WMI"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|