XMLRPCClient - performance issues

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

XMLRPCClient - performance issues

Postby ethrbunny » Fri Jun 26, 2009 1:43 pm

Im using the XMLRPCClient code from google (pskink -still here?) to access my db via Apache / PHP on a work-server. I started with some sample code ('getTime') and have worked up to making more 'serious' calls.

In all cases Im finding the performance to be extremely poor. I can see the server return the data within a few fractions of a second but once the return gets to XMLRPCClient it bogs down terribly. EG The 'getTime' function returns the time as a string ('2009-06-25 12:04:05') but when it hits this line:

Object obj = XMLRPCSerializer.deserialize(pullParser);

(line 356 in 'XMLRPCClient.java') it takes nearly 30 sec to return.

If I try to return something more complex (EG Hashmap - 8Kb ) it takes > 3 minutes to return.

Clearly Im doing something wrong. Suggestions?

Oh - I've tried this via the emulator and a device. Same results.

(EDIT) I traced into this function and it doesn't appear to be 'stuck' anywhere. The calls to KXMLParser just appear to be crazy slow.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Top

Re: XMLRPCClient - performance issues

Postby pskink » Fri Jun 26, 2009 9:39 pm

ethrbunny wrote:Im using the XMLRPCClient code from google (pskink -still here?) to access my db via Apache / PHP on a work-server. I started with some sample code ('getTime') and have worked up to making more 'serious' calls.

In all cases Im finding the performance to be extremely poor. I can see the server return the data within a few fractions of a second but once the return gets to XMLRPCClient it bogs down terribly. EG The 'getTime' function returns the time as a string ('2009-06-25 12:04:05') but when it hits this line:

Object obj = XMLRPCSerializer.deserialize(pullParser);

(line 356 in 'XMLRPCClient.java') it takes nearly 30 sec to return.

If I try to return something more complex (EG Hashmap - 8Kb ) it takes > 3 minutes to return.

Clearly Im doing something wrong. Suggestions?

Oh - I've tried this via the emulator and a device. Same results.

(EDIT) I traced into this function and it doesn't appear to be 'stuck' anywhere. The calls to KXMLParser just appear to be crazy slow.


did you try my test app with python server?
on my rather slow computer getTime takes more or less 100 ms
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby ethrbunny » Fri Jun 26, 2009 9:42 pm

I get the response from the server pretty quickly. It just takes longer than expected to parse it. And it gets worse pretty quickly when the data is more complex.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Postby pskink » Fri Jun 26, 2009 10:02 pm

ethrbunny wrote:I get the response from the server pretty quickly. It just takes longer than expected to parse it. And it gets worse pretty quickly when the data is more complex.


ok, try to use my local python server first.
if you get sufficient performance it means that there is some problem with the network or reading from it.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby ethrbunny » Fri Jun 26, 2009 10:04 pm

Im seeing the reply v quickly. The issue seems to be in the parsing.

I think my returned objects are too complex.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Postby pskink » Fri Jun 26, 2009 10:08 pm

ethrbunny wrote:I get the response from the server pretty quickly. It just takes longer than expected to parse it. And it gets worse pretty quickly when the data is more complex.


my first guess is Reader in callEx method.

try to change it:
XMLRPCClient line ~183

Reader reader = new InputStreamReader(new BufferedInputStream(entity.getContent()));
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby pskink » Fri Jun 26, 2009 10:11 pm

ethrbunny wrote:Im seeing the reply v quickly. The issue seems to be in the parsing.

I think my returned objects are too complex.


how complex are your objects? nested maps or something?
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Fri Jun 26, 2009 10:17 pm

ethrbunny wrote:Im seeing the reply v quickly. The issue seems to be in the parsing.

I think my returned objects are too complex.


but in your original post you said that getTime which is simple string takes 30 seconds, right? so i think it has something to do with network - mine takes as i said 100ms which is quite fast
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby ethrbunny » Fri Jun 26, 2009 10:23 pm

Changing the line to use BufferedInputStream did make a large difference.

My objects are nested to a few levels. I didn't think it was a big deal but Im thinking that I should slim them down as much as I can. Navigation in my app will be interesting to code.

Thank you for your help.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Postby pskink » Fri Jun 26, 2009 10:30 pm

ethrbunny wrote:Changing the line to use BufferedInputStream did make a large difference.

My objects are nested to a few levels. I didn't think it was a big deal but Im thinking that I should slim them down as much as I can. Navigation in my app will be interesting to code.

Thank you for your help.


so my first guess was right? getting data from network was the issue?
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby ethrbunny » Fri Jun 26, 2009 11:05 pm

No - the network portion is quite speedy. Its the parsing that's slow.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 6 guests