I am facing an issue where Picasso is unable to rapidly load images.
There are 3 ImageViews
which display left, middle and the right images.
On fast forward/backward, for a given time point, the left, middle and the right are chosen and displayed in the three box.
Here is the initialization. OkHttp
cache is 100MB along with 99MB of LruCache
new Picasso.Builder(getApplicationContext())
.downloader(new OkHttp3Downloader(picassoOkHttpClient))
.memoryCache(new LruCache(99999999))
.build();
The number of images over which the window moves is 3000+. So I preload the images as
picasso.load(imageUrl).fetch();
Average image size is 10KB - 320x180 so it amounts to 35MB which is less than 99MB LruCache
.
When the rapidly cycling through works, many of the images are GREEN
(from MEMORY
) and BLUE
(from DISK
) but then after few rapid cycles, the 3 images freeze or become very slow. At this time most of the images are BLUE
. App is still responding. No OutOfMemory or any other exception.
android:largeHeap
option is also enabled.
The hit ratio in the Picasso stats is very low. 150/3000.
The images are loaded as
picasso.load(leftUrl)
.noFade()
.noPlaceholder()
.into(leftImageView);
picasso.load(middleUrl)
.noFade()
.noPlaceholder()
.into(middleImageView);
picasso.load(rightUrl)
.noFade()
.noPlaceholder()
.into(rightImageView);
Issue 1 -> Picasso takes several minutes to download 3000+ images. Images load fast enough on other platforms and there is plenty of bandwidth (high enough to stream 4K)
Issue 2 -> Even after letting Picasso take its own time and finish loading all the images, it still freezes. Green ones are fast, Blue slower and then Blue ones freeze.
PS: I understand that "inflated" images will be much larger in size and will easily cross the 99MB bounds. That is why only some are green while most of them are blue.