Rich-text Reply

Optimizely causes a dramatic slow down in an Android application

jgn 02-13-15

Optimizely causes a dramatic slow down in an Android application

Hi,

When I am trying to run a single test within my ANDROID application, optimizely slows down the application dramatically. After using the Android Device Monitor, I found out that the Optimizely methods are invoked several thousand of times within a very short period of time. The whole application becomes pretty much unusable. The SDK version I am using is 0.2.6.

The problem does not occur when, at the very start of my application, I "draw the Optimizely O" and connect the running application instance to the optimizely preview/editor for testing. It does occur though, when I am trying to run the application as a normal target user would.

I attach a screen shot of the Android Device Monitor. 

https://drive.google.com/file/d/0B0iaj3ob__cRazFBdHBqMDdISWs/view?pli=1

What is wrong with this framework ?

 

Jan Gonera

jgn
Level 2

Suneet 02-13-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hi Jan,

 

Last week we released version 0.3.0 of the Android SDK which fixes the problem you're seeing. Can you upgrade to that version and see if you're still having issues?

 

Are you using Android Studio or eclipse?

 

If you're using Android studio, to upgrade, please do the following: 

 

1) Update your project's build.grade file to the following:
 
allprojects {
repositories {
jcenter()
maven {
}
}
}
 
2) Updating your app's build.grade file to the following:
dependencies {
compile 'com.optimizelySmiley Surprisedptimizely:+'
}
Optimizely
jgn 02-16-15
 

Re: Optimizely causes a dramatic slow down in an Android application

[ Edited ]

Nice,

it solved the problem I wrote about but now phones do not register with the experiment, and they all use the default variables instead of some default, some variations. The preview mode is broken too, it hangs when I enter the screen which uses a live variable. It proceeds once when I switch for a different variantion, but then disconnects imidiately.

jgn
Level 2
jgn 02-16-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Is this because Your com.optimizelySmiley Surprisedptimizely:0.3.0 is unable to connect to the online testing console like the com.optimizelySmiley Surprisedptimizely-dev-preview:0.2.6 can? Are you planning to make the 0.3.0 ver the next 'official' any time soon?

jgn
Level 2
Suneet 02-18-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hey JGN,

The 0.3.0 version is official-- are you unable to connect to the Visual Editor using the 0.3.0 version of the SDK, or are you unable to get the 0.3.0 version of the SDK installed?

Optimizely
jgn 02-18-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hi again,

i can see you have written about version 0.3.1 in Your tutorial. Unfortunately I cannot import that version by maven. There is no version 0.3.1 (the latest is 0.2.8) at http://dl.bintray.com/optimizely/optimizely-dev-preview/com/optimizely/optimizely-dev-preview/. Any chances You could add it? I will copy it from you github for the time being. Thanks !

 

jgn

jgn
Level 2
jgn 02-18-15
 

Re: Optimizely causes a dramatic slow down in an Android application

[ Edited ]

Hi againa,

After testing the version 0.3.1 downloaded from github, I'm getting the same symptoms:

1) Application works fine [without lags] when used normally, but the screen containg the "live-variable" always chooses the same, default variable. It seems that that optimizely does not connect to any remote endpoint to choose a desired version. The app instance do not register in the online "results" console either.

2) When in preview mode, app also works smoothly, until I try entering the screen with the live variable. The app freezes before moving to that screen. The screen is visible in the browser preview. When, in the browser preview, I switch to a different variant, the app loads the selected variant and instantly disconnects from the preview mode.

 

JGN

jgn
Level 2
Suneet 02-19-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hi JGN,

 

I'm sorry for the confusion. We have two different versions of the Android SDK. The "Developer preview", and the "public beta".

 

The public beta is more current and replaces the development preview.

 

Can you ensure that you have the right repo set up in your project's build.gradle file?

 

It should look like this:

 

allprojects {
  repositories {
    jcenter()
    maven {
      url 'http://dl.bintray.com/optimizely/optimizely'
    }
  }
}

Note: the URL here is actually a different URL than the dev preview build.

 

Then in your application's build.gradle file, you should specify the dependency as follows:

dependencies {
  compile 'com.optimizely:optimizely:+'
}

 

Notice that "dev-preview" is no longer in the artifact.

 

Once you do those two things, you should see these problems go away.

 

If you're still seeing this issues, I'm happy to jump on a call and dig deeper this week.

 

Optimizely
jgn 02-19-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hey !

All right, I see now. I pasted your configuration into gradle and a 0.3.1 version is loaded into my repo now. Unfortunately there are still some major problems Smiley Sad.

The application is working fine with the preview mode ! I can switch between the variants and see what they look like. Unfortunately, when outside the preview mode, and when using the app as a normal target user would, The live variables are all set to deaults (I am using only booleans, and they are always false. I have two variants, original is supposed to set it to "true", and variant1 is false). No application instances register in the results panel. The "visitors" field is stuck on zero. 

 

It's a problem.

 

Jgn

jgn
Level 2
Sohaib 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

I am experiencing the exact same problem. Is this fixed yet?
Level 2
Suneet 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hi Sohaib,

 

We recently released version 1.0 of Optimizely's Android SDK-- this version has the above problem fixed, as well as numerous other performance enhancements.

 

This link shows how to upgrade to version 1.0:

 

http://developers.optimizely.com/android/#upgrade_beta

 

Please try out this version and let us know if you see any performance issues. 

 

Thanks,

Suneet

Optimizely
Sohaib 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

[ Edited ]

Can't upgrade to 1.0.0. I am using Android Studio with gradle. I updated the dependency as

compile('com.optimizely: optimizely-rc:1.0.0@aar'){
transitive = true
}



allprojects part is same

allprojects {
repositories {
jcenter()
maven {
url 'http://dl.bintray.com/optimizely/optimizely'
}
}
}


Error:(61, 13) Failed to resolve: com.optimizely:optimizely-rc:1.0.0
<a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

 

Level 2
Suneet 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

[ Edited ]

My mistake Sohaib.

 

The dependency should be listed as the following. (The link I pointed you to is incorrect, I will update it).

 

dependencies {
  compile('com.optimizely:optimizely:+@aar') {
    transitive = true
  }
}

That should fix the build problem. 

Optimizely
Sohaib 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Thanks @Suneet. Build problem fixed now but underlying problem still remains as also mentioned by JGN.

I setup an experiment with 3 variations (Original, VariationOne, VariationTwo).
Declared two live variables in the app (both boolean). In Original both are false, in VariationOne and VariationTwo one of the boolean is set to true.
Everything works fine in Preview and Edit mode but when testing normal mode it always returns the default value. For testing I set the traffic allocation to 100% for VariationOne and still same results.

I enabled the verbose logging and noticed the data file it downloads from cdn is incorrect. Variations and live variable values are missing in it, I setup some goals as well which also missing in the json data file.

Perhaps its a data file versioning issue. Noticed every time it downloads the data file with same version even after I made some changes and save to experiment.
Level 2
Suneet 04-28-15
 

Re: Optimizely causes a dramatic slow down in an Android application

Hey Sohaib,

 

Thanks for the additional info. Would you be up for a quick call for us to trouble shoot with you? What time zone are you located in?

 

Thanks,

Suneet

Optimizely