Why does Flex use a single threaded model?
apache-flex, multithreading, performance, user-interface
Solution
I've seen very intensive trader desktop types of Flex apps which work fine in Flex's single threaded model. The reason is that internally Flex apps use async network IO. So the UI doesn't block when you are making the requests. You might be running into limitations with BlazeDS and should perhaps consider something that uses RTMP (like LCDS). RTMP is a more efficient protocol for streaming large quantities of data to the client. Also there are ways to optimize the client-side event handling and rendering code so that you don't bog down the UI. Christophe Coenraets has a few good demos on doing this kind of thing: http://coenraets.org/blog/?s=trader+desktop
What you are trying to do is certainly possible with Flex and there are people who have successfully done it.
However there is a open feature request for this on bugs.adobe.com: https://bugs.adobe.com/jira/browse/ASL-23
Problem
Over the past few weeks I have been building a prototype application using a Flex front end connected to a J2EE backend using blazeDS. The prototype is an experiment to learn flex and see what its suitability is for a complex trading application requiring a large number of dynamic updates (i.e > 20 a second) via a pub sub type model. During some lightweight performance tests it's become apparent that I need to use multiple threads to ensure the UI remains stable when receiving a large number of updates from the server. All was going well until I discovered that flex has a single threaded programming model! From a quick Google it looks as though there are numerous hacks to implement thread like behavior. I am sure many people must have been faced with a similar problem. Can people let me know: - Are there any good threading libs that are well maintained etc - Do other RIA technologies such as silverlight have the same problems. - Why did abobe implement a single thread model? - Are there any other tricks I can use to ensure my UI is stable.