Berkeley DB Java Edition and Android
I've recently done some work to get JE running under Android. This platform is significantly different from J2SE in several ways, but it is still close enough to a "real" J2SE that JE can run on it. For instance, the Android heap size is fixed at 16MB (vs. 64MB on a Sun J2SE JVM). JE runs fine on a 16MB heap, but many of our defaults assume more space. So rather than make all Android users tweak several parameters down , we do it for them when we detect the Android JVM ("Dalvik"). Additionally, I encountered some bugs in the JVM that now have workarounds built into the JE code. For example, the Dalvik Adler32 checksum code returns different values depending on whether you checksum an array a byte at a time or all at once.
The JE DPL will not work under Android at present because full runtime support for Java 5 Annotations is not implemented yet by the Dalvik runtime library (I think it may be the Apache Harmony RT). If we find that there is demand for DPL on Android we will implement an alternative to the annotation-based schema specification.
I ran some of our internal stress tests and JE seemed to hold up well. I am pretty sure that the long-running, heavy-IO style of test that I ran is not representative of what typical JE applications on Android. I didn't run any performance tests because it seemed pointless to benchmark an emulator.
The currently available "production" release of JE -- JE 3.2.x -- will not work on Android without some tweaks. But rather than force users to wait for JE 3.3.x (scheduled to be released "later"), we have decided to make a "Beta" version of 3.3.x available on our download site. Several things should be noted about this release:
- It is not supported. You may report bugs with it on the JE OTN forum but we may not fix them.
- You should not deploy any application with this release. It is Beta.
- This release is backward compatible with 3.2.x releases, so you can use it with existing JE 3.2.x environments. However, once 3.3.x touches those environments, they can never go back to 3.2.x. Nor can they go forward to a newer 3.3.x. Hence, you probably don't want to use 3.3.x with an existing environment.
- This release will not be forward compatible with future 3.3.x releases.
- Future 3.3.x releases will not be backward compatible with this release.
- Any environments and databases that you create with this release must necessarily be deleted before using a later 3.3.x release.
I apologize in advance for the registration that is required to download the 3.3.x beta release.
We'd like to hear your feedback on using JE with Android. You can either post comments to the JE OTN forum, or send me email (charles.lamb).