Think Inside the Box
Using Informix as an embedded database
Often, enterprise applications are separate from the databases that they rely on. But there is ongoing demand for database-driven, self-contained applications that work straight out of the box without additional configuration or administration.
In a server-based enterprise environment, professionals who have a deep understanding of database design and the dynamics of application behavior configure and maintain the databases. In many cases, however, this separation between application and database isn’t desirable, or even possible. For example, ISVs must decide which versions of a DBMS their applications will support, knowing that each extra version adds development time, quality assurance cycles, and customer-support costs. For some businesses, evaluating, maintaining, and supporting a stand-alone DBMS simply adds cost. What’s the solution to these ills? Try an embedded database server. An embedded database server is integrated within the application, invisible to the end user, and requires either minimal or zero administration.
Working with a database server that will be part of an embedded deployment requires a different approach from a traditional enterprise deployment. In this article, we discuss some of the critical needs of an embedded environment and the IBM® Informix® database features that help developers meet those requirements. We also explain how to create a fully automated embedded Informix deployment using the new Deployment Utility available in Informix 11.50.xC6 and later versions.
The unique challenges of embedded database deployments
Many of the characteristics that make a database server a good fit in a traditional enterprise environment also apply to an embedded database server. But the unique challenges of an embedded deployment change the priority—and sometimes even the meaning—of measures such as reliability, performance, and ease of deployment.
Reliability and independence
The single most important quality of an embedded database is reliability: it cannot fail, ever. The database server is hidden; there is no database administrator, and no direct manual intervention is possible. Achieving this level of stability starts with robust database engine design (a hallmark of Informix), but that is usually just the beginning.
An embedded database server should also provide programmable and autonomic capabilities, so that the application can perform any necessary maintenance tasks. If a problem does arise, the application must be able to recover the database server and quickly return it to full operation. Informix has an array of tools for enabling self-managing and self-tuning behavior. One of the most important—the Remote SQL Administration API—enables applications to programmatically issue SQL commands and perform many of the most common administration tasks necessary to keep the database running smoothly. For example, as the sizes of the databases supporting an application grow or shrink, the application can use the API to add storage space.
Where is Informix?
With the help of more than 2,500 business partners, numerous Informix database server instances have been deployed in enterprises across many industries. Most of these deployments are “invisible”—the end user does not know that an Informix instance is running behind the scenes.
- If you have ever placed a cell phone call in North America, Europe, or Asia, it’s likely that an application with an embedded Informix database validated your call information.
- Database applications in emergency call centers have relied on enterprise data replication features in Informix to ensure that critical systems are available 24x7.
- IP telephony call-processing systems use Informix as their embedded database server, as it can handle massive transaction volumes without sacrificing performance.
- It’s highly likely that an Informix database verified your major credit card transactions or registered your purchase at a point-of-sale application in a retail store.
- Informix is the default embedded content store for IBM Cognos Express—an integrated business intelligence and planning solution for midsize companies.
Applications can use the Informix Scheduler API to automate stored procedures or user-defined routine executions at regular intervals or in response to specific triggers. Using the example of storage space, the embedded Informix instance could be configured to monitor disk usage and add more storage when any DBspace consumes 80 percent of its allocated space.
An embedded Informix database server can also provide the application with a comprehensive view of database activity through the sysmaster, sysadmin, syscdr, and sysusers system databases. The sysmaster database is particularly useful because its tables can show dynamic information about the state of the database server, such as monitoring buffer pool activity, sessions, and transactions. For example, an application can scan the sysmaster database for sessions that may indicate idle connections, terminate the sessions, and recover those processing resources.
Performance and consistency
Performance is important for any database server, but in an embedded scenario, high performance must be accompanied by consistency and predictability. The database server should chug along continuously and evenly with the same performance characteristics as the organization’s demands increase. The Informix database server can automatically adapt to changing workloads without degrading performance.
Ease of deployment
Finally, deploying an embedded database server carries special challenges. Embedded database servers must often respect strict storage and memory limits. And just as the application it supports must be ready to operate out of the box, an embedded database server must require little or no setup. Any configuration must be fully automatic and completed by the application.
Creating an automated embedded Informix deployment
Informix provides many features, such as Deployment Wizard and Deployment Utility (DU), to create and deploy a customizable footprint for optimizing storage requirements in embedded deployments. You can use Deployment Wizard to select the individual components that need to be installed on disk. DU was introduced in Informix 11.50.xC6; it is a new technology that can be used to rapidly automate deployments for preconfigured instances.
Consider this example: IBM Cognos Express uses DU to rapidly deploy a preconfigured and tuned Informix database server as its default content store. The end user is not aware of the Informix database server’s existence, and the Cognos application handles the complete administration. To create an embedded Informix deployment, you install and configure a source instance, take a snapshot of the product and database spaces, and finally, use DU to silently deploy the preconfigured instance on the target.
On the source system, install and configure the Informix database server instance. During the application development phase, you will use this database server instance to design, develop, and tune the databases.
To optimize the storage footprint, you can selectively install features from the Informix 11.50 product using the Deployment Wizard (see Figure 1). The application will dictate which features need to be installed for the product. For example, if the application doesn’t intend to use On-Bar utilities, then that feature can be safely excluded fromRESOURCES the source instance. Selecting specific features through the Deployment Wizard is also supported during silent install. The end result of this development phase: an application with an optimally tuned Informix instance that is configured for its life as an embedded database server. This instance will now serve as a template for deployment on the target.
On the source, compress the contents of $INFORMIXDIR to an archive, such as source_infxdir.tgz. If you are working with an Informix installation on Microsoft Windows, then compress the contents of %INFORMIXDIR% to an archive, such as source_infxdir.zip. Also, compress the database spaces to another archive, such as source_dbspaces.tgz or source_dbspaces.zip.
To maximize reliability, we want to ensure that the database spaces are in a consistent state so their use can be resumed on the target. To achieve this, compress the database spaces after the instance has been blocked out or shut down. Currently, DU supports only database spaces that are configured as files in regular file systems (cooked files), which reside in a single directory.
On the target, copy the compressed archives, ifxdeploy executable, and ifxdeploy.conf from the source; extract source_dbspaces tgz; update the configuration parameters in ifxdeploy.conf; and set the required environment variables.
The following parameters will need to be updated in ifxdeploy.conf:
The following environment variables will need to be set:
Figure 1: The Informix Deployment Wizard.
On the target, execute the DU (ifxdeploy) to deploy the snapshot of the instance. For example:
You now should have a fully configured Informix database instance that is ready to run on the target.
More to come
Informix is particularly well suited for use as an embedded database. Its proven technology qualifies it as an industrial-strength DBMS for an embedded database server on multiple platforms. IBM continues to maintain a significant interest in enhancing the capabilities of Informix in various embedded environments, focusing on features such as deep embedding and integrated administration. Active research is in progress to make embedded deployments easier and to eliminate as much manual intervention as possible.