I am Ajay Chhatwal and am working on my GSoC project – Storing chat
history in a database.
The main objective of my project is to select and use a suitable
embedded database engine available for Java to store the chat history
for SIP Communicator.
This task requires a database which can perform simple SELECT and
INSERT queries efficiently. Also, since we need to search the History
records stored in the DB using various criteria, a relational database
would be more suited the application than an object based DB .
• Should be free and open source with compatible license
• Should be reliable
• Should support JDBC and act as a relational database
• INSERT operations are more important than SELECTs so optimisation
there would be appreciated (as major part of the work is writing
• Good documentation
• Recently updated and under active development
I have based my evaluation on the following performance benchmarks:
1. PolePosition (an open source database benchmark)
2. Performance Benchmarking of Embedded Databases on Jamie’s Weblog
From both these it is clear that for the purpose of our application,
HSQLDB has the best performance.
So, I first investigate the suitability of HSQLDB.
HSQLDB (HyperSQL DataBase) is the leading SQL relational database
engine written in Java. It has a JDBC driver and supports a rich
subset of ANSI-92 SQL (BNF tree format) plus SQL 99 and 2003
enhancements. It offers a small, fast database engine which offers
both in-memory and disk-based tables and supports embedded and server
1. Extremely good performance (see the benchmark results above)
2. Completely free to use and distribute under an open source license,
based on the standard BSD license and is, according to their website,
fully compatible with all major open source licenses
3. Stable and reliable and is currently being used as a database and
persistence engine in many Open Source Software projects (like open
office and JBoss) and even in commercial projects and products. (like
( http://hsqldb.org/web/hsqlUsing.html )
4. Very active and popular project with a vibrant developer community.
5. Extensive documentation is included.
1.All the rows in the result set are built in memory, so very large
result sets may not be possible.
2.It seems that HSQLDB doesn’t adhere to the ACID properties fully.
I believe that the Pros out weight the cons because of the following reasons:
1.Huge result sets are not likely to occur when a user is searching
his/her chat history. However, processing of huge result sets can be
done using a simple workaround using ID fields and select multiple
2.The DB is reliable enough for storage of chat history which, I
believe, doesn’t really require being ACID safe as each query is
expected to be independent of the other.
Also, there are ways to achieve this if required (
Also, version 1.9(alpha-2) supports READ COMMITED mode also.
On the basis of these observations, I feel that HSQLDB is well suited
to the purpose of storing chat history.
These are my initial observations and I wish to have some feedback
from the community.
Suggestions, comments as well as criticism from the community are most
PolePosition.pdf (275 KB)