15 Replies Latest reply on Mar 26, 2007 7:24 AM by ebrentnelson

    Flex deployed on a large scale?

    rpeters1983 Level 1
      We plan on developing a new product and Flex popped in my mind as a development platform. I know a good deal of Flex 1.5, but only used it for personal sites.

      My question is how well Flex behaves in a large scale environment to those who have deployed it in such. Server load will be at least thousand / day.

        • 1. Re: Flex deployed on a large scale?
          phi2265 Level 1
          Well, I'm about to find out! The only concerns I have are the initial download, abilities of the client's computer, and my upload bandwidth.

          My initial download is ~2mb(i know its big, gotta reduce), everything runs fine on my pcs/macs.. but they're new, and my bandwidth is 1mbps up. I'm launching the site on March 1st, and moving from 3rd party hosting to our own server (already done, just gotta switch links). I get between 200-1600 loads per day.. average is ~500. I'm looking forward to the launch, and I'll post more info as I get it.

          note: I've been having a ton of fun developing the site in flex.. it's been a great learning experience.
          • 2. Re: Flex deployed on a large scale?
            JohnLeger Level 1
            Hey phi2265,

            I'd like to check your site out when it's launched on Mar 1st. Would you mind posting the address for us to check it out. Maybe your site give us some ideas for our own apps.

            • 3. Re: Flex deployed on a large scale?
              phi2265 Level 1
              Yeah, no problem. I'm going to wait until then to post the link however. I'm still finishing and testing.

              Does anyone know of any other sites that use Flex or another RIA? It seems to me like there aren't many out there yet... is the concept just too new? I'm guessing things are still in development.

              Its nice to be on the edge of things, but frustrating sometimes.. I'm actually stuck on something right now, haha.

              • 4. Flex deployed on a large scale?
                WestSide Level 1
                I have something in the works *grin*

                Most are in development I believe. I have found that it takes a little bit of resourcefulness to get going since Flex 2 has not been out for *that* long. But I am a sponge for information so I have no problem scouring the blogs, etc to figure out how to piece my app together as a first crack at it.

                Since languages like Java, C++, Perl, CF, ASP, PHP, have been around for a while, the market seems to be saturated somewhat with these skills. You have guys with 10+ years of C++, etc. It's a good opportunity and time for us to put something together and I plan on taking full advantage of it!

                Just my two cents...

                • 5. Re: Flex deployed on a large scale?
                  phi2265 Level 1
                  Yeah I know what you mean. I've searched all over the web for solutions sometimes.

                  Any sites that you frequent?
                  I joined the flex coders group on yahoo.. http://tech.groups.yahoo.com/group/flexcoders/ theres a ton of info there.
                  I've also found useful code on cflex.net

                  • 6. Re: Flex deployed on a large scale?
                    jpwrunyan Level 1
                    Hmm... I made one medium sized application in 1.5 (approx 10 screens, user access <1000 times per day) and it seems to be working alright for the client.

                    Now I am working on a major application (over 20 main screens, and definately access>1000 times per day) and it is not going well. I am really worried about the bugs and memory issues of Flex 2.0. I have also not found a sure-fire way to address these potential issues. I can say this: for the size of application we are making, Flex and Flash Player just aren't up to the job. Compiled and executed as a single .swf application results in 755MB ram usage and for some reason a constant CPU access of 60% (Pentium 4 proc.) after accessing every screen. And this is just FlashPlayer doing what it is supposed to. Me, not being a computer engineer, can't really address these problems. Flex and AS aren't C. I can't control memory usage with my code. By breaking up the huge application into smaller ones and then loading those via an SWFLoader I may be able to avoid this rampant resource hogging but it's sort of illogical from an application architecture standpoint because this is ONE application.

                    As a developer, I can see plenty of places to streamline the application but this simply isn't possible when dealing with the client. They want this screen to look and act this way and that screen to look and act the other way. I can talk about how if both screens use the same layout and logic they can both use the same template class, share static resources, blah blah until I am blue in the face but it won't matter because they are the client and they decide how the application is going to look--at the expense of streamlining. That's just the real world. Then I have to somehow make it work.
                    By the way... before you think "just use view states!", I do use those--and bitwise logic flags for more complicated configurations--it's still not enough, although it did cut approx 160 screens in documentation form down to just 20 in implementation.

                    In worst case scenarios, I have to deny the client what they want and if they ask me why, I have to reply "it can't be done with Flex". Then their satisfaction in the product drops. Flex suddenly isn't as incredible as it seemed at first. Doesn't matter how pretty and animated the screens are when if you run them over an hour your computer slows to a halt or .ttc fonts stop loading (HUGE issue here in Japan).

                    I have yet to see a sample application that comes close to the scale of our current project: A library book browser? neat but that's just square one; A Commodore 64 emulator? cute. no place in business; A real-estate browswer? in our project that would be the equivalent of ONE SCREEN out of the entire application.

                    I like Flex. It's fun--on a small scale. But I never want to develop a real world business application using it again. There are way more (and way more skilled) Java, JSP, PHP, etc. etc. developers out there than Flex developers who can make much more robust applications. It's a shame the client got caught up in the hype of Flex RIA before the technology was ready for the task.

                    Very long story short: Beware using Flex for an involved application.

                    It's going to require exponentially more time than a smaller, less ambitious project--especially if you don't purchase FDS. And oh my god implementing a Flex application on a legacy Struts framework... kill me now! As much as I hate "page-refresh" applications, Flex (both 1.5 and 2.0) has not proven to be the god-send that I had hoped and dreamed it would be as a developer. What can you expect, though? It's only been out a few years.... And as far as clients' perspectives go, the price for FDS also certainly doesn't help make it appealing. That is why it is so embarrassing to tell them their dream application is quickly becoming an egregious memory hog.

                    Anyway, good luck if you take on your project with flex. Just be careful!
                    • 7. Flex deployed on a large scale?
                      phi2265 Level 1

                      Sounds like your application is huge. Can I ask what it is? Mine is for a small newspaper. I have ~15-18 dynamic pages and a database, using FDS.
                      Could you give us some info on your application, such as initial download size, what kind of content you are displaying, and whatever else you think would be relevant.

                      I tried what you were talking about, and left my page up for 24 hours, its still up and uses about 470MB of RAM. I haven't had a problem at all with processor usage, but then again all the Macs/PCs I have here are either dual CPU or dual core with 1.5GB-4GB of RAM as well as decent GPUs. I have looked at my application from some of my PCs at home, all are single core (P4, AMD64, AMD AthlonXP, Centrino) with 512MB-1GB of RAM, and I haven't had much of an issue. I also haven't tested the application extensively on these machines yet. I'm going to cut back on some of the transitions and effects I have. The scroll/wipe effects and transitions seem to use a lot of RAM and processor cycles.

                      A soltion to the problem of a lot of RAM being used might be to unload/reload the application when the program is idle. I can think of how this would be done, but without testing it I can't be sure that it will work, or even help. You might be able to detect when the application has been idle, for say.. 2 hours, or whatever.. after this 2 hours, you might be able to force the application to unload, then load again. I'm not sure if that would solve the problem of massive RAM usage, or even help at all.. but you might want to try it out on a sample application to see if it could work. Another thought along the same line is to unload resources as they are not being used, I have no idea if that is possible but might be worth looking into, I'm going to look into these things myself.

                      Let me know what you think...

                      Edit: More info--- the application currently uses 470MB of RAM and 6-15% CPU at idle. This is on my development machine, with an AMD 64 X2, dual 2.0Ghz, 4GB RAM, and 6800XT 256MB video card... running Windows XP 64bit.

                      • 8. Flex deployed on a large scale?
                        phi2265 Level 1
                        I have some potentially useful information...

                        If you haven't read about deferred cration and container creationPolicy, you might want to go to the docs.

                        Flex creates all components and containers in an application on load unless their creationPolicy is set to 'none'. You can set a container's creationPolicy to 'none' making it not be created on the application load. To make the container load, you call containerName.createComponentsFromDescriptors() . This noticably decreased my application startup time. However, I've decided not to use it because of the delay it causes when you call the container to be created. The delay is small, but it causes any appear effects you have to not show because the container takes too long to load. If you have no effects in the showEffect property of the container, this is probably still a good idea.
                        The other option is ordered creation. You set creationProperty="queued" and creationIndex="(number here)" and all of the containers are loaded in the order you set, which results in a shorter percieved startup time.

                        A few components/controls support the unload command. Those being Loader, LoaderInfo and SWFLoader. There is also an UNLOAD event. When using a Loader to load content, previous content is unloaded prior to the new content being loaded.. this doesn't seem like it would be very helpful in reducing RAM usage.

                        I haven't been able to find anything on application idle, resume, or anything like that yet. Something might be able to be performed by using a timer and catching the mouse over or focus or something like that.. but its looking doubtful.

                        • 9. Flex deployed on a large scale?
                          phi2265 Level 1
                          I've been busy so I haven't had a chance to post this... but my site is live...
                          Feel free to check it out and leave some feedback/comments/suggestions on here if you wish.
                          I know the initial load time is a little slow, I need to cut down size/quality of the embedded images.

                          • 10. Re: Flex deployed on a large scale?
                            TucsonJava Level 1

                            I took a look at your site and think you would benefit by checking out this component created by Quietly Scheming.

                            http://www.quietlyscheming.com/blog/2007/01/23/some-thoughts-on-doubt-on-flex-as-the-best- option-orhow-i-made-my-flex-images-stop-dancing/

                            Good luck
                            • 11. Re: Flex deployed on a large scale?
                              phi2265 Level 1
                              Woah thats awesome, that problem is annoying for me. I just downloaded the component. Looks like I'm going to learn something new today!


                              • 12. Re: Flex deployed on a large scale?
                                jpwrunyan Level 1
                                sorry for the late reply.
                                My application is a order receival, billing, and dispatching system. I really can't say too much about it. It is not an internet app. It is for use on an intranet. Anyway, my issues are all primarily related to garbage collection. I am overhauling the thing to use modules (as of 2.0.1) but still have a heck of a time with garbage collection. I think basically there are still too many bugs in the Adobe Flex framework components that haywire even modular apps (which are supposed to be able to readily free up resources). My shell app download is currently about a 300 meg. The internal modules are smaller (like 30-200 kb).

                                I don't follow what you mean by reloading the application. Do you mean with navigateToURL()? In the middle of a task this could be a very bad thing as queried/processed data would be lost. Holding it in session or a local object, etc is the only thing I can think of in such a case and that is not something I want to debug.

                                Anyway, for me it is not the application's static state that is the problem. It's when the user uses it over a long period of time, loading and reloading screens that don't get properly removed from memory that problems occur. Some memory leakage I can handle... but not megabytes worth per screen load. This inherent tendency to leak coupled with the extreme difficulty of not just finding the leak but also fixing it (if even possible! ie: PopUpManager) make me reluctant to consider Flex seriously as a large legacy application front-end.

                                And before someone suggests it, let me add: weakly referencing listeners is not enough!
                                • 13. Re: Flex deployed on a large scale?
                                  Are you saying your swf file is 300 MB? How long have you been working on this application? Something is not right if the Shell is 300 meg? WOW , some operating systems are't much more than that. This is very unusual. I have been using flex since 2.0 came out and built several 20+ screen systems with no problems. Are you includinge a lot of data in the swf file or using remoting to get data as needed for each screen?
                                  • 14. Re: Flex deployed on a large scale?
                                    phi2265 Level 1

                                    Reloading the application is out of the question, it might not be possible anyway. That was just an idea I had, but I have since researched it.

                                    What is causing your shell application to be so large? Mine is ~2mb and I thought that was big. However, intranet is a different story. Especially if you're running on a gigabit or fiber network, then 300mb is nothing.

                                    • 15. Re: Flex deployed on a large scale?
                                      I know there isn't a solution to the garbage collection problem, but I just wanted to give my two cents about this issue. I am creating a mid-level business app for usage on an intranet and the internet. I got half way done with it and found that it eats memory. I then found out a way to modulize it... that actually made it worse (memory usage was added everytime the module was added/removed). So to make a long story short... I'm not going to get my project finished on time because you can't manually do garbage collection in the Flash player... boo