Use C to connect to MySQL

Source: Internet
Author: User
Tags benchmark documentation odbc

In the application development of database, the contradiction between performance and cost is often encountered. Taking the problems that the author encounters in the development of stock market inquiry and trading system, it is required to respond to a large number of concurrent users ' data query requests while recording the market data of more than 1000 stocks per minute in real time. In view of cost-effective and easy to maintain, the system also requires a PC server, Windows NT platform hardware and software environment implementation. At the beginning, we adopted MS SQL Server 6.5 as database system, developed the front-end of accessing database with Visual C + + 6.0, applied ODBC data interface, and found that it still couldn't meet the performance requirement after a lot of database configuration and program optimization. After the use of SQL Server Db-library interface, bypassing the ODBC interpretation layer, you can update the market data per second 30 times, while supporting 20-30 or so of the concurrent user inquiries, basically meet the requirements (single PC server, single PII350 CPU, memory 128M, SCSI hard drive). Is it possible to further improve the performance and load capacity of the system? After analysis, the database server is the bottleneck of the system. Of course, you can use UNIX server + large database system platform, but its development, operation, maintenance costs than the computer +windows NT platform costs several times higher. We often encounter such contradictions in the development of other systems. How to build a database system with large capacity, high efficiency, easy maintenance and high cost performance on the microcomputer platform?

The research on the database application system based on microcomputer platform in China, the typical distributed mail system such as NetEase, adopts the Freebsd+mysql platform, its capacity, load capacity and response speed are excellent. The author looked at MySQL's documentation and found that MySQL is a very good database system in GNU software (i.e. opensource free software), fully compliant with SQL92 (Entry level) and ODBC (level 0-2) specifications, A very efficient relational database management system is implemented on a POSIX-compliant operating system. According to the documentation provided by MySQL, its data operations are the most efficient in all databases, benchmark the following table:

Reading 2000000 rows by index
Database Seconds
Mysql 367
Mysql_odbc 464
Db2_odbc 1206
Informix_odbc 121126
Ms-sql_odbc 1634
Oracle_odbc 20800
Solid_odbc 877
Sybase_odbc 17614
inserting 350768 rows
Database Seconds
Mysql 381
Mysql_odbc 619
Db2_odbc 3460
Informix_odbc 2692
Ms-sql_odbc 4012
Oracle_odbc 11291
Solid_odbc 1801
Sybase_odbc 4802

As you can see from MySQL's benchmark, MySQL has a very good performance (of course, the test of the MySQL system may be optimized, the measured data may be selected for MySQL), and MySQL provides support for Windows NT. Can Windows Nt+mysql be an ideal choice for building high-performance database applications? The author uses MySQL data interface rewrite the program, after a period of time running, proved that MySQL is indeed an efficient and stable database, very suitable for building large capacity, high efficiency, easy maintenance, cost-effective database application system. MySQL is the installation, operation, development of the experience and share with you.

Related Article

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.