# Perst

Perst is an open source, dual license, object-oriented embedded database management system (ODBMS). Both the Java programming language, and the C# programming language versions are compact and Perst has been implemented on smart phones running the Android and Windows Phone (WP7) operating systems.

## History

Perst was launched in 2003, in Russia. It was designed to achieve high-performance by tightly integrating the database with the programming language: Perst directly stores data in the language objects. In 2006 McObject LLC, based in Issaquah, WA took over the development of Perst. It continues to offer free downloads and has added commercial license options.
Perst was first written in Java, and ported to C#. Although originally designed for desktop- and server-based software, Perst has also found usage in providing database management for mobile applications running on devices such as smartphones. These mobile devices typically have hardware constraints, with limited RAM and few CPU cycles available and non-standard (for database systems) operating requirements (such as support for Java ME, or Silverlight in the Windows Phone 7 mobile platform).

## Versions

Currently available versions of Perst are Perst for .NET, Perst for Java and Perst Lite. Perst for Java and Perst Lite are bundled in a single software distribution.
Perst for .NET supports C# versions 1.0 and 2.0 with the same source code. Support for specific C# 2.0 features (such as template classes) is provided at compile time. It is compatible with both standard and compact .NET frameworks, as well as Silverlight, and can operate on both Microsoft Windows Phone 7 (WP7) and Windows Embedded Compact (formerly Windows CE).
Perst for Java supports J2SE/J2EE versions 1.3 and 1.4, as well as J2SE/J2EE version 5. It is compatible with the Android smartphone environment.
Perst Lite is the Perst for Java implementation that runs on devices (such as BlackBerry smartphones) based on the Java ME (J2ME) mobile device platform. It has a memory footprint approximately 30 percent smaller than standard Perst.

## In detail
### Size

The Perst engine’s size is 5,000 lines of source code, and its run time random-access memory (RAM) needs range from 30K to 300K.]

### Transactions

Perst transactions support the ACID properties (atomicity, consistency, isolation, durability) with automatic recovery.

### Querying

Perst provides a subset of SQL for filtering elements of a container class. For access to stored objects, Perst implements specialized collection classes including:
* B-tree indexes
* R-tree indexes
* In-memory database container classes based on T-trees
* k-d tree indexes
* Radix tree (Patricia trie) indexes
* Time series class to deal efficiently with small fixed-size objects, such as stock quotes
* Specialized versions of collections for thick indexes (indexes with many duplicates) and bit indexes (keys with a restricted number of possible values)

### Schema evolution

To facilitate changes to an existing database design (database schema), Perst implements "lazy" database schema evolution. When an object instance is loaded from the database, its class descriptor is compared with the format of the class in the application. If they are not identical, and the object is to be changed, then the object is converted and stored in the new format. With an "eager" schema evolution format changes would sweep through the database all at once.

### Additional features

* Garbage collection
* Multi-threaded
* Support for Language Integrated Query (LINQ)
* XML import/export utilities
* Master/slave replication support, with the option to run read-only queries on slave nodes
* Full text search
* Integration with AspectJ and JAssist aspect-oriented programming tools

## Example Implementations

ProScout is a demo midlet for using Perst Lite in the Java ME environment. The demonstration is of a discrete note-taking facility for a sports recruiter. Originally implemented for the Blackberry, it has also been deployed on the Nokia S60.
McObject provides a demo app of a CRM system using Perst for .NET, including a fully text-searchable contact database that runs in the desktop browser in Silverlight. Andy Wigley, of appamundi, ported this demo app to Windows Phone and described the project in a series of blog postings.

## Licensing

Users can redistribute and/or modify Perst under the terms of the GNU General Public License (version 2 or later) as published by the Free Software Foundation. For individuals or organizations that cannot or do not wish to comply with the GPL, a commercial license is available from McObject.