Highlighted

HTTPService request takes 100% cpu

rmeador

06-05-2008

Hi,

I've developed a Flex app that displays an organization chart
of employees in a company. As the user navigates around the tree,
it requests data as needed from the server using an HTTPService
object. I've noticed that when the application first starts up, it
takes about 7 seconds for it to load the data. During this time, my
CPU is pegged at 100%, which causes the browser to be completely
unresponsive. This happens in both IE and Firefox. Subsequent
requests to the server complete in well under a second (usually
~200ms), but still use substantial CPU power. The data being
returned from the server is in JSON format, and usually consists of
about 5 nested objects with ~10 string properties each (this seems
like a pretty light load to me). I'm using the corelib JSON decoder
library. There is nothing different about the requests being made
except that when the app first starts up, it makes 2 requests
simultaneously (both from the same HTTPService object but with
different parameters on the request) -- could this be causing the
massive slowdown? It seems like Flex does a busy-wait while the
first request completes before beginning the second. Through
trace() statements added to my code, I can see it make both web
requests one immediately after the other, the first one returns in
under a second, then it waits for a long time before the second one
returns. Googling for this problem hasn't returned anyone else
experiencing this problem. Any help improving the performance of my
application would be greatly appreciated.