Picking a Database for Embedded Systems
Tags: flutter, discuss, database, community
Published: 2022-06-30 12:46:00

## Exploring Today's Embedded Database Marketplace

With the increasing demand for higher computing capabilities, embedded databases are becoming more important in today's technological landscape. The market for embedded systems is [expected to grow from USD 100.33 billion in 2020 to USD 137.7 billion by 2028](https://www.verifiedmarketresearch.com/product/embedded-systems-market/).



### "Embedded" in the database world

The term "embedded" can have two different meanings when talking about databases:

1. "**[Embedded database](https://www.techopedia.com/definition/30660/embedded-database)**" means that the database is deeply integrated into the software and does not require a server. Also known as an "embedded database management system”( or embedded DBMS for short)

2. A "**database for embedded systems**" is a database designed specifically for use in embedded systems. These are systems made up of tightly integrated hardware and software, such as electronic control units (ECUs), Internet of Things (IoT) devices, or smartphones. A database for such systems must be small and optimised to run on low-resource hardware (e.g. restricted CPU, memory, battery). In these use cases, a high-performance database is usually a top priority to get the most out of these restricted devices.

The fact that these terms are used interchangeably may cause some confusion. Not all embedded databases are appropriate for use in embedded systems, and databases used in embedded systems are not necessarily embedded in software. Maintaining a clear distinction between these terms is therefore important. 


---

## So, What is an Embedded System Exactly?
Embedded systems are ubiquitous today. They are used in most industries, ranging from [manufacturing](https://objectbox.io/iiot-edge-computing/) and [healthcare](https://objectbox.io/iot-edge-computing-and-digitalization-in-healthcare/), to [automotive](https://objectbox.io/connected-car-data-storage-and-sync/) and consumer electronics. An embedded system is essentially a collection of hardware and software components that are designed to process and control the system's specific tasks. These components include processors, controllers, input-output devices, outer peripheral devices, and many others. Embedded systems are typically limited in terms of CPU, power, memory, and connectivity (WiFi, Bluetooth, ZigBee, and so on). The definition, however, is not linked to hardware constraints, and the landscape is generally heterogeneous.

Embedded systems are frequently components of larger systems, and each embedded system performs a limited number of specific functions within the larger system. Embedded systems, in essence, form a complex decentralised system. ECUs (in cars)smartphones, microcontrollers, cameras, smart watches, ATMs, robots, sensors and many more are examples of embedded systems.

---

### Edge Databases: “Embedded Database” AND “Database for Embedded Systems” 
Because embedded systems frequently have limited resources and are often found in decentralised systems with limited bandwidth, or intermittent or no connectivity , the efficiency and footprint of the local storage alongside smart and efficient data synchronisation are critical. These requirements spawned a new market for databases designed specifically for embedded systems. Embedded databases may often be useful in embedded systems due to their light weight and high performance. 

![Venn Diagram describing the intersecting space Edge Databases are the most impactful](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w7fvqco7bhflpuubrv5m.jpeg)

[Edge Databases](https://objectbox.io/what-is-an-edge-database-and-why-do-you-need-one/) are typically embedded databases optimised for resource efficiency on restricted decentralised devices (typically embedded devices) with limited resources. New Edge databases solve the challenge of an insanely growing number of decentralised embedded devices, both in the professional / industrial as well as the consumer world. Edge Databases solve data synchronisation out-of-the-box, making the data from these devices easily and efficiently accessible. 

---


## Why Would You Use an Edge Database in an Embedded System?

To begin with, local data storage enabled by embedded databases is a significant benefit for typical embedded systems that frequently face connectivity issues (due to device, use case, data protection needs, location, or costs) or operate in real-time scenarios (e.g., on the factory floor or in the car). Because of the limited connectivity or real-time requirements that these systems frequently face, they cannot always be relied on to retrieve data from the cloud. Instead, a clever solution is to keep data on the device locally and only sync it with other parts of the system when necessary and possible. 
 

> In addition to handling a lot of data, embedded systems frequently operate with erratic or intermittent connections. So, an [effective synchronisation solution](https://objectbox.io/sync/) should not only sync data whenever a connection is available but empower the developers to choose which data to synchronise when and, moreover, do so as efficiently as possible (minimising data traversal, enhancing speed). For instance, differential sync is effective because it reduces network costs and unnecessary energy use (and thus CO2 emissions) by only sending changes to the server.
 
The two most important features of databases in embedded systems are performance and reliability. A database designed for use in embedded systems should perform well on devices with limited CPU and memory. This is why embedded databases may perform well in embedded systems; they are largely designed to function in such environments. Because some of them are truly tiny, they thrive in small applications. While improving performance helps to eliminate some risks, it does not help with unexpected power outages. Therefore, a good data recovery procedure is also important.
 
Let's have a look at the features of embedded databases that make them a great choice for embedded systems.

---


###The Benefits of Embedded Databases
1. **High performance**: True embedded databases benefit from a simpler architecture because they don't require a separate server module. Although the client/server architecture benefits from the server's ability to be installed on a more powerful computer, there is an inherent risk that also rises. By removing the client/server communication layer, you can reduce complexity and improve performance.
2. **Reliability**: Because many embedded devices run on battery power, a power outage is a possibility. As a result, the data management solution should be designed to ensure that data is completely recovered in the event of a power outage. This is a popular feature of embedded databases designed specifically for embedded systems.
3. **Ease of use and low maintenance**:  Another significant advantage of using an embedded database is its ease of implementation and small support requirements. Because designing embedded devices frequently necessitates working under time constraints, choosing an out-of-the-box data persistence solution is the best option for many projects. Because embedded databases are directly embedded in the application, they do not require administration and can manage themselves effectively.
4. **Small footprint**: Embedded databases aren't always small, but some are as small as 1 MB, making them ideal for mobile and IoT devices with limited memory.
5. **Scalability**: As the number of embedded devices grows, so does the volume of data. A good solution should be able to handle large amounts of data as well as adapt to new device features and easily change to meet the needs of a new device. Rigid database schemas fall short in this regard.

---


### How to Choose an Embedded Database
The following are the most important factors to consider when selecting an embedded database: ACID (atomicity, consistency, isolation, durability) compliance, CRUD performance, footprint, and data sync.

####An In-Depth Examination of the Embedded Database Market


|Database solution|Primary model   	| Minimum footprint  	| Sync  	|Languages   	|
|---	|---	|---	|---	|---	|
| [Berkeley DB](https://en.wikipedia.org/wiki/Berkeley_DB)   	| NoSQL database; key-value store  	| <2MB  	|No   	| C++, C#, Java, Perl, PHP, Python, Ruby, Smalltalk and Tcl  	|
|[Couchbase Lite](https://www.couchbase.com/products/lite)   	| NoSQL DB; document store  	|1-5MB   	|Sync needs a Couchbase Server| Swift, Objective-C, Java (Android), Java (Non-Android), Kotlin, C#, JavaScript, C	|
|extremeDB   	| In-memory relational DB, hybrid persistence  	|< 1 MB  	|No   	| C, C#, C++, Java, Lua, Python, Rust  	|
| [LMDB] (https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Database)   	| Key-value store  	|<1MB   	|No   	| C++, Java, Python, Lua, Go, Ruby, Objective C, Javascript, C#, Perl, PHP, etc  	|
|[Mongo Realm](https://www.mongodb.com/realm)   	| Object-oriented NoSQL database  	|5 MB+   	|Sync only via Mongo Cloud   	| Swift, Objective-C, Java, Kotlin, C#, and JavaScript  	|
|[ObjectBox](https://objectbox.io)   	| Object-oriented NoSQL database |<1MB | Offline Sync, on-premise Sync, Cloud Sync, p2p Sync is planned 	|C,C++, Java, Kotlin, Swift, Go, Flutter / Dart, Python   	|
|[RocksDB](https://en.wikipedia.org/wiki/RocksDB)   	|  Key-value store 	|   	| No  	| C++, C, Java, Python, NodeJS, Go, PHP, Rust, and others  	|
|[SQLite](https://www.sqlite.org/index.html)   	| Relational  	|<1MB   	|No   	| C/C++, Tcl, Python, Java, Go, MATLAB, PHP, and more  	|
|UnQLite   	| NoSQL; document & key-value store  	|~ 1.5 MB  	|No   	| C/C++, Python  	|


      

---



## Selecting an Embedded Database

Several factors must be considered when [selecting a database](https://greenrobot.org/news/mobile-databases-sqlite-alternatives-and-nosql-for-android-and-ios/) for an embedded system. On highly restricted devices, even small changes in one of these parameters can have a big impact. Even minor variations in one of these parameters can have a significant impact on highly restricted devices. While developing your own solution with a specific device in mind may be feasible, the additional effort and tight deadlines usually do not justify this decision. This is why we recommend using a database, such as ObjectBox, which is designed for embedded system specifics with the added bonus of [an efficient data sync solution](https://objectbox.io/what-is-data-synchronization-how-to-keep-data-in-sync/).

There are several embedded databases that work well on embedded devices. Each has advantages and disadvantages, so you must decide which is best for your application. However, if you have a use case where performance is especially important, ObjectBox [outperforms all competitors](https://objectbox.io/android-database-java-kotlin-3-0-benchmarks/) across all CRUD operations (Create, Read, Update, Delete). ObjectBox is a next-generation infrastructure software for Edge Computing. In addition to fast local data storage, it enables decentralised secure data flows and combines flexible data management with on-device security. You can assess it for yourself by looking at our GitHub profile and [performance benchmarks](https://github.com/objectbox/objectbox-performance).