Go, ObjectBox Golang!

Go, ObjectBox Golang!

Today, we are bringing the power of ObjectBox to Go. Whatever solution you are building, be it a web service, an IoT/IIoT solution, or any data-driven application, you will benefit from the efficiency and speed of ObjectBox (see benchmarks below). Let us know what you think!

Let’s look at some code, and see how ObjectBox persists Go structs (objects):

The ObjectBox Go API allows you to create data-driven cross-platform apps. ObjectBox supports x64 and 32 bit ARM (ARMv6 and ARMv7) CPUs, enabling you to benefit from a super-fast scalable database on IoT devices, industrial edge gateways or, for example, the Raspberry Pi family (from the minimalistic Pi Zero to the high-spec Pi 3B+). At the same time, you can now target desktop and server apps running on Linux, MacOS, or Windows using Go.

How to get started

To get started, please have a look at the ObjectBox Go docs. Here’s the TL;DR version for your bash:

This will clone the repository to your GOPATH, download the objectbox-c library and install the ObjectBox code generator.

At this point you can start using ObjectBox in your project – just define a struct you want to persist, add  //go:generate objectbox-gogen  comment in the same file and run go generate ./… on your project. See Getting started for more details.

Performance benchmarks

We have done some quick CRUD performance tests to give you an impression about the speed ObjectBox provides. On a i7-8850H CPU, ObjectBox consistently processes over 1.5 million CRUD operations per second with 4.4 million object reads per second:

The sources for the performance tests are part of the GitHub repository.

To put these numbers into perspective, we also did a comparison using an edge computing platform and two leading NoSQL databases. We won’t spill the names and final numbers just yet, as we are going to release all the details very soon. 😉

Disclaimer: ObjectBox was the only database running in embedded mode, which is not supported by the others in this setup. Obviously this can have a significant impact on performance. On the other hand, this is the most resource friendly mode of operation (RAM and CPU), which might be very relevant if you target restricted ARM32 devices.

Your feedback

This is the first public version of ObjectBox for Go and we are more than excited to get your feedback on it. We have prepared a short questionnaire for you, which should only take 1-2 minutes. Your feedback is extremely valuable to make ObjectBox a fun tool to use.

Future work

While this initial release covers all basic features, the native core of ObjectBox offers much more than what is currently exposed to Go. For example, a complete set of query conditions and relations between objects. Also, we will introduce a client/server operation mode. This will allow ObjectBox to run in Containers (e.g. Docker) and in classic server setups. As a major theme, the ObjectBox team is also working on data synchronization across devices. This keeps edge devices and gateways “in-sync”. Sync also enables seamless integration with mobile apps (Android and iOS) pushing relevant data to mobile clients and back.  Of course sync will also be available for Go. You can sign up here for updates on sync.

 

Let’s dive into the iOS World

Let’s dive into the iOS World

Two days ago, we attended the Swift Lighting Talks Meetup in Munich for the very first time. We had beer, pizza and listened to Sebastian Sellmeier’s presentation on making programming accessible and Denis Grebennicov’s presentation on the process of developing a Document Scanner app. It was fun and very instructive, thanks!

We also gave a 15 minute sneak peek talk about our ObjectBox iOS binding. Markus covered the basics of ObjectBox before sharing how we managed to overcome iOS constraints in our APIs. Finally, he disclosed the first (early) performance benchmarks on iOS, which we think are quite encouraging…

Check out the full talk in the video below.

In case you want to learn more about ObjectBox on iOS, sign up here for news and Early Access.
Special thanks to Stefan Mayer-PoppThe Munich iOS Developers Meetup for organizing this event and to Mayflower for hosting it.

 

We officially released our YouTube channel, we will post videos about ObjectBox and Tech in general. Subscribe to stay tuned.

 

Loading Data – SQLite DB vs. ObjectBox DB

Loading Data – SQLite DB vs. ObjectBox DB

Code Example n°1

Beautiful
Code

Loading data.
In just 2 lines.

LOADING DATA FROM A MOBILE DATABASE

Loading data in a Mobile App can be lenghty… if you work with SQLite directly. That’s why we built the fastest ORM on the market: greenDAO. With greenDAO its only 2 lines of code. With ObjectBox, our Mobile Database, its also 2 lines of code. Objectbox simply gives you additional speed out of the box. If you are already working with greenDAO, you can switch to using ObjectBox almost seamlessly. Check out our greenDAO CompatLayer to learn how you can easily switch and boost your app performance with minimal effort.

CODE COMPARISON

SQlite / greenDAO / ObjectBox

SQLITE DATABASE

String[] columns = { “note”, “date_changed” };

String[] idArgs = { String.valueOf(id) };

SQLiteCursor cursor = (SQLiteCursor) db.query(“notes”, columns, “_id=?”, idArgs, null, null, “note”);

try {

if (cursor.getCount() != 1) {

throw new Exception(“Unexpected count: ” +cursor.getCount());

}

cursor.moveToNext();

String note = cursor.getString(0);

String date = cursor.getString(1);

updateUi(note, date);

} finally {

cursor.close();

}

GREENDAO ORM

Note note = noteDao.load(id);

updateUi(note.getNote(), note.getDate());

OBJECTBOX DB

Note note = noteBox.get(id);

updateUi(note.getNote(), note.getDate());

ObjectBox 0.9.10 – getting closer to 1.0

ObjectBox 0.9.10 – getting closer to 1.0

ObjectBox 0.9.10 - getting closer to 1.0

Do you know our new super fast mobile database ObjectBox yet? With versions 0.9.9 and the just released 0.9.10, ObjectBox made great progress to stabilize features for the 1.0 release. With an increasing number of apps using ObjectBox, we were able to spot and fix some less obvious issues. We believe that ObjectBox 0.9.10 is the most stable release ever. If you did not dare to check out the beta version yet: now is a good time to have a closer look.

(more…)

Mobile Database Comparison: SQLite and SQLite alternatives compared in a handy matrix

Mobile Database Comparison: SQLite and SQLite alternatives compared in a handy matrix

Mobile databases: SQLite and SQLite alternatives for Android and iOS

Updated comparison
Note: This is an updated version of an earlier Mobile Database Comparison.

What is a mobile database?

While Wikipedia defines a mobile database as “either a stationary database that can be connected to by a mobile computing device […] over a mobile network, or a database which is actually stored by the mobile device,” we solely refer to databases that run on the mobile device itself (on-device).

What are the advantages and disadvantages of working with SQLite?

SQLite is easily the most established mobile database, probably the only “established” mobile database. SQLite has been around since the year 2000 and is embedded with iOS and Android since the beginning. SQLite is a relational database.

advantages

disadvantages

  • Toolchain, e.g. DB browser
  • No dependencies; included with Android and iOS
  • Developers can exactly define the data schema they want
  • Developers have full control, e.g. they can do handwritten SQL queries
  • SQL is a powerful and established query language, and SQLite supports most of it
  • Debuggable data: developers can grab the database file and analyze it
  • Rock-solid, widely used technology, established since the year 2000
  • Using SQLite means a lot of boilerplate code and thus inefficiencies (also in the long run with the app maintenance)
  • 1 MB BLOB Limitation on Android
  • No compile time checks (e.g. SQL queries)
  • SQLite performance is unreliable
  • SQL is another language to master
  • SQL queries can get long and complicated
  • Testability (how to mock a database?)
  • Especially when database views are involved, maintainability may be poor with SQLite

What are SQLite alternatives?

There are plenty of alternatives to working with SQLite directly. If you simply want to avoid writing lots of SQL and boilerplate code, you can use an object abstraction on top of SQLite. This abstraction is usually an ORM (object/relational mapper).

However, if you rather seek a replacement for SQLite completely, there are also a few alternative databases: Couchbase Lite, Interbase, LevelDB, Oracle Berkeley DB (formerly Oracle’s mobile database was “Oracle Database Lite”), Realm, SnappyDB, SQL Anywhere, and UnQLite.

Obviously, if your also looking for alternatives that are not on-device mobile databases, there are a lot of cloud / server options out there that you can use as a replacement like e.g. Firebase. Generally speaking, with these your app will not be (fully) offline-capable, costs on the serverside will go up, and they may also be rather slow in execution.

To give you an overview, we have compiled a small comparison table:

NameAndroid / iOSType of data storedSync CentralSync P2PData level encryptionLicense / business modelShort descriptionMinimum Footprint sizeCompany
Couchbase Lite, now Couchbase Mobile
Android / iOSJSON Documents / NoSQL db YesYesDatabase encryption with SQLCipher (256-bit AES)Apache 2.0Embedded / portable db with P2P and central synchronization (sync) support. Secure SSL.Couchbase
ForestDB
Android / iOSKey-value pairs / NoSQL dbNoNoNoApache 2.0Portable lightweight key-value store, NoSQL database.
InterBase ToGo / IBLite
Android / iOSRelationalNoNo256bit AES strength encryptionProprietaryEmbeddable SQL database.400 KBEmbarcadero
LevelDB
Android / iOSKey-value pairs / NoSQL dbNoNoNoNew BSDPortable lightweight key-value store, NoSQL db, doesn't support indexes, very fast for some use cases; earlier available enchmarks from 2011 have been removed unfortunately.350kBLevelDB Team
Oracle Database Lite
Android / iOSRelational and Key-Value-StoreWith Oracle Mobile ServerWith Oracle Mobile Server128-bit AES Standard encryptionProprietaryEmbedded / portable db with P2P and central sync support as well as support for sync with SQLite.< 1MBOracle Corporation
Snappy DB
AndroidKey-value pairs / NoSQL dbNoNoNoApache 2.0Portable lightweight key-value store, NoSQL db based on LevelDB.Nabil HACHICHA
Realm
Android / iOSObject DatabaseNoNoYes Apache 2.0 License APIs with proprietary sync.Embedded object db.Realm Inc.
SQL Anywhere; Ultralite is the mobile version
Android / iOSRelationalDependantNoAES-FIPS cipher encryption for full database or selected tablesProprietaryEmbedded / portable db with central snyc support with a stationary database.Database memory footprint: only 300KB for mobile devicesSybase iAnywhere
SQLite
embedded on iOS and AndroidRelationalNoNoNo, Use SQLCipher to encrypt SQLitePublic domainC programming library; clear market leader).500KiBHwaci
UnQLite
Android / iOSKey-value pairs / document store / NoSQL dbNoNo2-Clause BSDPortable lightweight embedded db; self-contained C library without dependency.Symisc systems
If you are interested in an indication of the diffusion rate of databases and mobile databases, check out the following database popularity ranking: http://db-engines.com/en/ran.

Thanks for reading and sharing. Please let us know what you’re missing.