VOLTDB Introduction: Use a memory-high performance database for Java code

Source: Internet
Author: User
Tags mongodb query requires voltdb

Brief introduction

Over the past few years, a new database management system called NoSQL has emerged. These data stores are designed to overcome the challenges of the type of data load that must be addressed when extending traditional relational databases to handle some applications, such as Amazon. The implementation of this scalability requires a price: NoSQL systems typically do not conform to ACID (atomicity, consistency, isolation, and durability); they ultimately consistently show that all data updates are eventually propagated through the system given a certain amount of time. This does not meet the requirements of certain types of applications.

In the past, relational database management systems for online transaction processing (OLTP) did provide consistency assurance (they are ACID-compliant), but they are more difficult and expensive to extend. The study also shows that they are not particularly efficient: The CPU spends about 10% of its time retrieving and updating records, while the remaining 90% is used for tasks such as buffer management, locking, Latch (Latch), and logging.

Traditional relational databases, such as MySQL, and most NoSQL systems store their data on disk. Voltdb stores all content in primary memory. If you can avoid entering the disk, you can achieve significant performance gains and access to memory is one order of magnitude faster than accessing the disk. Today's RAM costs are much cheaper than in the past, and with the advent of 64-bit computing, you can come with a standard, buy-and-use server with hundreds of GB of primary memory.

The VOLTDB database consists of a large number of partitions scattered across multiple sites (servers). Each partition running on one site is single-threaded, eliminating the overhead associated with locking and latches in a typical multithreaded environment, and transaction requests are performed sequentially.

The NoSQL database (as its name implies) does not use SQL as the query language. For example, a MongoDB query uses JSON expressions. Both Riak and CouchDB support queries using the Map/reduce feature. VOLTDB uses SQL as its query language, and most developers who have used databases are familiar with SQL, which is an advantage in this sense. However, some NoSQL databases provide a query interface that is not the case.

Access to the data stored in the VOLTDB is done by using stored procedures written in the Java language, and the SQL statement is embedded in a stored procedure. One of the advantages of executing SQL queries from within stored procedures, relative to JDBC, is that each transaction needs only one round-trip between the client and the server. This eliminates the latency associated with multiple calls between applications and databases over the network.

VOLTDB has two versions: an open source community version and a paid enterprise version. This article will focus on the community version. Some features are only available in the Enterprise Edition, and these features are not covered here.

Entry

To try some of the examples in this article, you need to download and install VOLTDB. The version used in this article is the 2.5 version of the community version.

VOLTDB requires an operating system based on 64-bit Linux; This requirement also applies to MAC OS 10.6. You will also need to install the Java Development Kit (JDK 6). You can use Eclipse to edit the source code.

Amazon EC2 and VMware images are also available for download, and they can be used immediately after downloading them.

Voltdb is distributed as a tar compressed file, so after downloading it, you can extract it by using the following command: $ TAR-ZXVF voltdb-2.5.tar.gz-c ~/.

In this instance, I chose to install it in my home directory, which is ideal for development purposes, and you can extract it into the directory of your choice.

After decompression, add the bin directory to your path: $ export path= $PATH: ~/voltdb-2.5/bin.

The bin directory contains commands that can be useful when you deploy the sample application.

Next, download the source code supporting this article. Unzip it to the directory of your choice. The sample application mainly deals with the employees of Acme Inc., a fictitious company.

A typical VOLTDB application consists of the following files:

A project definition file (Project.xml) that contains information such as which stored procedures are available, the location of the database schema file, and the partition information.

A deployment file (Deployment.xml) that contains information such as the number of sites per host.

Database schema (Ddl.sql).

Source code, such as: stored Procedures and clients.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.