In order to prove this theory we had to first verify that anywhere is indeed built on top of the sqlcipher library. To do this we had to identify where IBM puts all the database generation code for anywhere eventually determining that this is in the ibmmobilefirstplatformfoundationjsonstore.jar file. We opened that up and were eventually able to identify that the databaseaccessorimpl.class does indeed utilize the sqlcipher package. Thus, to then test that the sqlcipher database management setting does indeed impact the performance of anywhere on the zebra devices we updated the databaseaccessorimpl class to add the PRAGMA cipher_memory_security = OFF statement on creation of the db.
public void createTable(JSONStoreSyncPolicy syncpolicy)
{
String name = this.schema.getName();
logger.logTrace("creating database \"" + name + "\"");
if (syncpolicy != JSONStoreSyncPolicy.SYNC_NONE) {
execSQL("CREATE TABLE {0} ({1} INTEGER PRIMARY KEY AUTOINCREMENT, {2} {3} TEXT, {4} REAL DEFAULT 0, {5} INTEGER DEFAULT 0, {6} TEXT, {7} TEXT, {8} TEXT);", new Object[] { name, "_id", formatSchemaColumns(), "json", "_dirty", "_deleted", "_operation", "_cloudant_id", "_cloudant_rev" });
} else {
execSQL("CREATE TABLE {0} ({1} INTEGER PRIMARY KEY AUTOINCREMENT, {2} {3} TEXT, {4} REAL DEFAULT 0, {5} INTEGER DEFAULT 0, {6} TEXT);", new Object[] { name, "_id", formatSchemaColumns(), "json", "_dirty", "_deleted", "_operation" });
}
execSQL("PRAGMA cipher_memory_security = OFF", new Object[]{});
}
We rebuilt the anywhere apk and tested the new apk against the old apk on the zebra and samsung devices and found that there is a significant performance boost on the zebra. As expected the samsung pretty much functioned the same with both apks. We then compared performance for various actions (system data download, lookup download, login) with the zebra with the new apk and found that it performs in line with the Samsung devices. Thus, this setting was confirmed to get the zebra performing in line with other android devices and remove the latency we were experiencing.
Thus,
- update databaseaccessorimpl.class with PRAGMA cipher_memory_security = OFF
- add new class to ibmmobilefirstplatformfoundationjsonstore.jar (if I recall the build uses this jar in a speciffic location in the directory so make sure you are updating the correct one)
- build new apk (you can check the directory that gets updated with the new build, forget the exact directory name, to validate that the jar in the newly built apk is indeed the new jar)
- test new apk
------------------------------
Victor Chin
------------------------------
Original Message:
Sent: Tue July 27, 2021 12:27 PM
From: Muhammed Zahid Soluk
Subject: Device Log in Issues
Hi Victor,
Could you please share your steps for updating databaseaccessorimpl class? We're facing same performance problems with Zebra devices.
Regards,
Muhammed Zahid Soluk
------------------------------
Muhammed Zahid Soluk
------------------------------
Original Message:
Sent: Thu July 09, 2020 02:42 PM
From: Victor Chin
Subject: Device Log in Issues
Update: we suspected that the performance issue on our zebra device was due to performance issues with the sqlcipher database. To prove out that theory we updated the databaseaccessorimpl class to add the PRAGMA cipher_memory_security = OFF statement on creation of the db. tested the new apk against the old apk on the zebra and other android devices and there is significant performance boost on the zebra. As expected the other android devices pretty much function the same with both. Compared performance for various actions (system data download, lookup download, login) and the zebra with the new apk performs in line with the other androids. So this setting seems to get the zebra performing in line with other android devices.
------------------------------
Victor Chin
Original Message:
Sent: Wed July 08, 2020 12:32 PM
From: Victor Chin
Subject: Device Log in Issues
Update: IBM has a fix that will significantly speed up the login time. However we are still experiencing performance discrepencies between our zebra and android devices but now we dont have anything that we cant live with (1 second action delayed to 5 seconds is much different than 20 seconds delayed to minutes).
WIth that said we are still investigating the device performance discrepency.
------------------------------
Victor Chin
Original Message:
Sent: Wed July 01, 2020 03:01 PM
From: Victor Chin
Subject: Device Log in Issues
Further info: looking at the cursor outputs in the adb logs of a samsung s8 connected vs the zebra connected it seems that the sqlite read/writes are slower on the zebra than on the samsung. This is supported by the fact that just every operation that would require db read/writes seem to be on the same magnitude slower when comparing the two devices (synchs, lookup data download, login, etc). I am by no means a true android app developer so I may not be on the right track, but this is our current theory.
Any ideas as to things to explore/try or ideas as to why there would be a significant performance difference with sqlite between the two devices? Or just ways to further confirm the theory?
------------------------------
Victor Chin