CBL 1.4.1 Vs 2.1.1 data download comparison Review for android. Spoiler : AWESOME WORK TEAM COUCHBASE


#1

FLASHBACK :
We download almost 60000 documents when the app starts for the very first time and 30000 documents every week in the enterprise app we have developed using CBL 1.4.1 and Android.

No matter what we did we never been able to download more then 100 Docs per second even after having multiple no network lag, more then 2 sync gateway , latest couchbase server with 3 nodes for mere 100k documents. more then enough RAM and everything.

It was heart breaking but we found some work arounds like creating a service which will have a couchbase lite inside it and will provide the pre populated latest database to the app whenever it will install and also every week. But then this got a lot of issue.

We became sure that this is not an issue of Couchbase server or Sync gateway. It was JVM and polling in CBL 1.4.1 which never let us be in peace.

BIRTH OF COUCHBASE LITE 2.X:
When couchbase 2.0 came the good news started coming like linq like queries , websocket support for android etc. but we were not ready to adopt this as there were a lot of breaking changes and deadline was near. Also peer to peer and encryption was not available.

Come 2.1.1 : I tries creating a simple app which downloads documents and displays documents and time it took to download. This app is created in android and CBL 1.4.1 for 1 version and 2.1.1 for another.

Results CBL 2.1.1 without network lag is 6 to 10 times faster than 1.4.1.

You heard it right 6X to 10X faster. The web sockets along with CBL core in C++ is amazingly fast. And these results are with a very basic machine where couchbase and sync gateway both are on same machine. The only catch is look for the network delay between sync gateway and your app’s network.

60K documents were downloaded under a minute without any fancy work around. The best part is speed keeps on increasing opposite to 1.4.1.

Good job guys. Team CBL Rocks. :smile:

Regards
Pankaj Sharma

@priya.rajagopal @househippo @jens


#2

Thank you, @pankaj.sharma ! Stay tuned for more advancements coming your way with our upcoming 2.x releases!


#3

I’m so happy to hear real-world confirmation of the speed up — a lot of work went into that!

By coincidence, yesterday I found and fixed an inefficient design in the pull code; the fix speeds up local-to-local replication a lot and should improve networked replication too. So stay tuned for even more speed :rocket:


#4

This is very interesting…

I am working on an app with 70-75.000 documents and I just tested it on Android.

It took for ages to sync - and it even broke down after 16 minutes having synced 47-48.000 documents. I print the number of docs completed (arg.Status.Progress.Completed) in the OnReplicationEvent when the activity is “Busy”. For Android I can see that this is called for each and every document - whereas for iOS I only see “bulks” of data.

Is that something I can somehow adjust/tune?

I tested on a device (the emulator was way slower) running Android 8.1. The Sync.Gateway is 2.1.1 and the server is Community Edition 6.0.0.


#5

But what version of Couchbase Lite??

(And please don’t wake up an old thread that’s only tangentially related; it’s better to start a new one.)


#6

Yeah, Ok… I was just searching for related issues…

CB Lite is 2.1.2 (C#)


#7

Can you profile the app to get an idea of what’s taking so much time? Replicator performance should be pretty consistent across platforms since most of the work is done in C++ code. (Aside from differences in hardware capabilities, of course.)


#8

Hmmm… not really sure.

It’s in Visual Studio (for Mac) - and I can’t really find any options to profile…

Can any of the debugging options of the sync/CBLite help us?


#9

Can you run Instruments on the app? (Don’t you have to use Xcode to run the app on a device anyway?)