Adobe AIR applications slow response after idle time - apache-flex

I spent hundreds of ours developing an Adobe AIR Application with Flex 4.0 and now I thought I should have finished, but after letting the application run for more than a few hours the UI-responsiveness begins to lack...
What I do:
My application uses custom chromes by setting backgroundImages with transparency to BorderContainers within Window-modules. I open up many different popups, which all are based on the Window-Class (not TitleWindow!) and created and closed dynamically in ActionScript. By using the Flex Profiler I certainly know, that the garbage collector destroys all the allocated ressources correctly, and the memory consumption does not rise with application uptime. Further the profiler shows me, that none of my methods occupate extensive cpu-time, so this also should be ok.
What is really interesting:
If I continously interact with the application (click buttons, write text,...) nothing happens and everything is fine, BUT if I do not interact with the application for several minutes and then come back - the UI-responsiveness is really poor!
Really poor means, that if I type some text into a TextInput-Control, I can watch every single letter being written with a delay of at least 1 second!
Has anyone experienced a similar situation, or someone who knows, what the problem could be?
My suggestion is, that after some activity the flash-player-runtime limits the cpu-usage of the AIR application, and doesn't give back full power when the user returns.
I tested the application with Flex 4.0, Flex 4.1, AIR 1.5, AIR 2.0 with Flash Player 9 and also Flash Player 10 running on Windows XP and Windows 7...

I have finally found the solution!
The new spark-components introduced with Flex 4 added a property called "backgroundFramerate" to the WindowedApplication-class. By default, this property is set to 1, which means that AIR automatically throttles the framerate when the main (!) application-window get's inactive. Unfortunately this framerate is used for the whole application, including all other window-instances which could be in the foreground and active!
After disabling the automatic framerate-throttling by setting the backgroundFramerate-property to -1 all the problems were gone!
Altough, I know, that instiating new window-derived objects to show popup-windows, I believe that this is a bug in the Flex 4 which is still not fixed.

Related

MVVM Light Xamarin.Android - UI controls do not update after some time passed‏

The issue occours after ca. 2 minutes passed (about 1800 times updated). TextViews simply stop to update with no reason, even if accelerometer updates are still working. Our team is working on multithreaded aplication where we have to update some UI control values on UI thread (thats problably the reason why the issue occours). We have spent amount of time trying to figure out what might be the problem and finally we have decited to report it as an issue. I have prepared some sample code based on accelerometer functionality, but in fact the same problem occours when we are trying to use other hadrware devices or sensors (e.g. bluetooth). Here is the link to the sample app repository:
https://mvvmlightbug.visualstudio.com/DefaultCollection/_git/MVVM%20Light%20bug#path=%2F&version=GBmaster&_a=contents
During debug process I've found out that Garbage Collector is somehow removing my bindings. It was because of WeakReference usage in MVVMLight for Android library. I've lust replaced all WeakReferences with object types and since then there is no more problem.
For MVVMLight creatrors: please ensure that WeakReferences are the best solution - you should rather replace them, because Android's GC is removing bindings with no reason.

scaling an azure website

I have a Standard website in Azure with a small instance, (1 core and 1.75 GB memory). It seems to be coping fine and handling the requests smoothly, although I am expecting a lot more within the week.
It is unclear though under what circumstances I should be looking to scale the instance size to the next level ie to Medium. (Besides MemoryWorkingSet of course, rather obvious :))
ie. Will moving up to a Medium instance resolve high CPU time ?
What other telltales should I be watching for ?
I am NOT comfortable scaling the number of instances to more than one at the moment until I resolve some cache issues.
I think the key point I am trying to understand is the link between the metrics provided and the means of scaling available regardless of it being scaled horizontally or vertically.
I am trying to keep the average response time as low as possible as the number of users that interact with the website increase.
Which of the other metrics will alert me when the load on the server is getting to its limits & I will need to scale Vertically ?
The idea behind scaling in Azure is to scale horizontally, i.e. add more instances. Azure can do this for you automatically. If you can't add more instances, Azure can't do the scaling for you automatically.
You can move to Medium instance, overall capacity will increase, but it is impossible to say what your application will require under heavy load. I suggest you run profiler and load test to find out the weak parts of your app and improve these before you have an actual increase in useage.

BlazeDS slow with large number of objects

I'm developing a mobile app using Flex and I have run into some problems using BlazeDS. Some users request a (relatively) pretty large amount of data from my server, which returns in about 2 seconds. The data consists of some pretty simple objects (Client, which has a name/phone/email, and a few other properties, some of which are other nested objects with more properties). The largest requests consist of no more than about 10,000 of these objects, which is only a few MB in size. The problem I am running into is that as soon as the server sends its response, the mobile screen locks up while the data is being processed. For 10,000 objects, this can take several minutes and sometimes even crash the device, and at best leave the user with a frozen screen the entire time. For the average user, it is at least 2-5 seconds of frozen screen. This is not only an issue for devices with limited capabilities. This also happens on my PC (i5 processor, 8GB RAM). From what I can tell, this downtime is taking place somewhere between when the device receives the response and when I can access the data. Setting a breakpoint on the first line of the following RemoteObject result handler has the screen lock up BEFORE it reaches the breakpoint:
protected function myResultHandler(event:ResultEvent):void
{
var result:ArrayCollection = event.result as ArrayCollection;
//Do other stuff here
}
I know very little about BlazeDS and AMF, so my only guess is that the freezing happens while the objects are being created on the device. Is there any way to speed up this process at all? Should I normally expect to see really poor performance like this? Any help would be greatly appreciated.
After a couple of hours digging around, I found the solution to my problem: On the server side, the objects I was sending had a ton of extraneous properties unrelated to the information I needed on the mobile app. In addition, there were helper methods on those classes in the form getMyHelper() which would attempt to generate a property on the Flex side. This resulted in a huge list of reference errors being thrown during the download since no properties with those names existed in the AS objects. I created stripped down 'lite' versions of the objects I needed sent across with no extra properties or methods. The massive lists now display nearly instantaneously after receiving the response from the server.

JavaFX stress test failed

We are looking into JavaFX 2.2 as a framework for building a desktop application. But before burning many developer hours we wanted to make sure that JavaFX is fit for the job, so we made a small stress test to see if it leaks resources. The test shows and hides a Stage, containing a Label and a Button, in a never ending loop. We would expect this to continue forever without problems, but after approx 15500 iterations we get this exception
java.lang.RuntimeException: could not create platform window
at com.sun.glass.ui.Window.<init>(Window.java:180)
at com.sun.glass.ui.win.WinWindow.<init>(WinWindow.java:20)
at com.sun.glass.ui.win.WinApplication.createWindow(WinApplication.java:97)
at com.sun.javafx.tk.quantum.WindowStage.initPlatformWindow(WindowStage.java:131)
at com.sun.javafx.tk.quantum.WindowStage.init(WindowStage.java:82)
at com.sun.javafx.tk.quantum.QuantumToolkit.createTKStage(QuantumToolkit.java:501)
at javafx.stage.Stage.impl_visibleChanging(Stage.java:928)
at javafx.stage.Window$10.invalidated(Window.java:689)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
at javafx.stage.Window.setShowing(Window.java:782)
at javafx.stage.Window.show(Window.java:797)
at javafx.stage.Stage.show(Stage.java:229)
at leaktest.FXMLController.showHideDialog(FXMLController.java:58)
Our best guess is that show()/hide() on Stage leaks some resource, and dheapmon reveals that desktop heap memory is actually leaked during the test, but we don't hit the limit (20 MB on our test machine). GDI handle and USER handle limits are not the problem either since those handles are not leaked (according to Process explorer). Any suggestions to what causes the exception?
This was a memory leak in the window disposal code of JavaFX. The leak was fixed in JavaFX 2.2.40 as part of bug fix RT-26822 Win: Stage Exception:could not create platform window.

Performance monitor shows 4294967293 sessions active

I have an ASP.Net 3.5 website running in IIS 6 on Windows Server 2003 R2. It is a relatively small internal application that probably serves less than ten users at any given time. The server has 4 Gig of memory and shows that 3+ Gig is available while the site is active.
Just minutes after restarting the web application Performance monitor shows that there is a whopping 4,294,967,293 sessions active! I am fairly certain that this number is incorrect; at the time this reading there were only 100 requests to the website.
Has anyone else experienced this kind odd behavior from perf mon? Any ideas on how to get an accurate reading?
UPDATE: After running for about an hour the number of active sessions has dropped by 4. So it does seem to be responding to sessions timing out.
Could be an overflow, but my money's on an underflow. I think that the program started with 0 people, someone logged off, and then the number of sessions went negative.
Well, 2^32 = 4,294,967,296, so sounds like there's some kind of overflow occurring. Can't say exactly why.
We have the same problem. It looks like MS has a Hotfix available: http://support.microsoft.com/kb/969722
Update 9/10/2009: Our IT department contacted MS for the Hotfix. It fixed our issue. We are running .NET 2.0 if it matters any.
I am also showing a high number, currently 4,294,967,268.
Every time I abandon a Session, the Sessions abandoned count goes up by 1, and the Sessions Active count decreases by 1. Currently my abandoned session count = 16, so this number probably started at 4,294,967,84.
Is there a fix for this?
My counters were working fine, but one morning I logged in remotely to the production server, and the counter was on this huge number (which is as somebody mentioned very close to 2^32 indicating an underflow). But the only difference from the day before when everything worked was the fact that during the night, windows had installed updates.
So for some reason these updates caused this pretty annoying error.
Observing the counter a little more, I found out that whenever the application is restarted - after some time with no traffic, the counter starts correctly at zero. When users start logging on, it increments fine. When they start logging off again, it still decrements fine until it reaches what is supposed to be zero. At that point it goes bananas...
Sigh...
If you have to use your existing statistics, I opened the log file in Excel and used a formula to bring a more accurate value. I cannot guarantee its accuracy, but the results did look okay:
If B2 is the (aspnet_wp)\Sessions Active value , and the formula sits in C2
/* This one is quicker as it doesn't have to do the extra calculations */
=IF(B2>1073741824,4294967296-B2,B2)
Or
/* This one is clearer what is going on */
=IF(B2>power(2,30),(4*power(2,30))-B2,B2)
P.S. (I feel your pain - I have to explain why they have 4.2 billion sessions opening whereas a second earlier they had 0!)

Resources