Home Database Mysql Tutorial 为什么数据库连接的创建开销大

为什么数据库连接的创建开销大

Jun 07, 2016 pm 03:48 PM
Why create database connect

为什么连接开销比较大? 开发人员经常认为建立一个数据库是一个简单的要求,不就是在数据库服务器和初始化用户之间的一个网络往返吗,但实际上,一个数据库连接在驱动和数据库服务器之间有多次网络往返,例如,当某个驱动连接到Oracle或Sybase时,这个连接会

为什么连接开销比较大?

开发人员经常认为建立一个数据库是一个简单的要求,不就是在数据库服务器和初始化用户之间的一个网络往返吗,但实际上,一个数据库连接在驱动和数据库服务器之间有多次网络往返,例如,当某个驱动连接到Oracle或Sybase时,这个连接会有7到10和网络往返,执行了一系列的动作:

◆校验用户的身份证书

◆在数据库驱动期望的代码页设置和数据库可用的代码页设置之间进行协商(如果必要的话)

◆获取数据库版本信息

◆确定用于通信的最理想的数据库协议包大小

◆设置会话设置

此外,数据库管理(开发人员承担数据库管理员职责时的最佳做法)系统要确定建立连接使用的资源,包括性能开销较大的磁盘I/O和内存分配,你可能会认为将应用程序部署到数据库服务器上会消除网络往返,在大多数情况下这并不现实,因为现实世界中大部分企业并不会这么干,它们有很多的应用程序,有很多的数据库,此外,数据库服务器都会为数据库系统进行精心的性能调整,一般不会为不同的应用程序进行调整,即使可以在一台机器上安装数据库和应用程序,但这样也会有单点故障的隐患。



摘自:http://database.51cto.com/art/200907/136845.htm

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Why is the rise or fall of virtual currency prices? Why is the rise or fall of virtual currency prices? Why is the rise or fall of virtual currency prices? Why is the rise or fall of virtual currency prices? Apr 21, 2025 am 08:57 AM

Factors of rising virtual currency prices include: 1. Increased market demand, 2. Decreased supply, 3. Stimulated positive news, 4. Optimistic market sentiment, 5. Macroeconomic environment; Decline factors include: 1. Decreased market demand, 2. Increased supply, 3. Strike of negative news, 4. Pessimistic market sentiment, 5. Macroeconomic environment.

Redis: Understanding Its Architecture and Purpose Redis: Understanding Its Architecture and Purpose Apr 26, 2025 am 12:11 AM

Redis is a memory data structure storage system, mainly used as a database, cache and message broker. Its core features include single-threaded model, I/O multiplexing, persistence mechanism, replication and clustering functions. Redis is commonly used in practical applications for caching, session storage, and message queues. It can significantly improve its performance by selecting the right data structure, using pipelines and transactions, and monitoring and tuning.

What is the difference between php framework laravel and yii What is the difference between php framework laravel and yii Apr 30, 2025 pm 02:24 PM

The main differences between Laravel and Yii are design concepts, functional characteristics and usage scenarios. 1.Laravel focuses on the simplicity and pleasure of development, and provides rich functions such as EloquentORM and Artisan tools, suitable for rapid development and beginners. 2.Yii emphasizes performance and efficiency, is suitable for high-load applications, and provides efficient ActiveRecord and cache systems, but has a steep learning curve.

MongoDB's Future: The State of the Database MongoDB's Future: The State of the Database Apr 25, 2025 am 12:21 AM

MongoDB's future is full of possibilities: 1. The development of cloud-native databases, 2. The fields of artificial intelligence and big data are focused, 3. The improvement of security and compliance. MongoDB continues to advance and make breakthroughs in technological innovation, market position and future development direction.

Why should you listen Why should you listen Apr 21, 2025 pm 09:00 PM

Concordium: A public first-level blockchain platform that takes into account privacy and compliance is a public first-level blockchain platform. Its core lies in the clever integration of identity verification with privacy and regulatory compliance. Founded in 2018 by Lars Seier Christensen, the platform’s core technology embeds cryptographic identities at the protocol level of each transaction. This unique design ensures responsibility traceability while protecting user privacy, effectively solving the problem of conflicts between anonymity and regulatory requirements in the blockchain field. To alleviate this problem, Concordium utilizes Zero Knowledge Proof (ZKP) technology, allowing users to verify specific identity attributes without the need to disclose unnecessary personal information. This means that, despite every

Steps to add and delete fields to MySQL tables Steps to add and delete fields to MySQL tables Apr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

How to process sensor data in C? How to process sensor data in C? Apr 28, 2025 pm 10:00 PM

C is suitable for processing sensor data due to its high performance and low-level control capabilities. Specific steps include: 1. Data collection: Obtain data through the hardware interface. 2. Data analysis: convert the original data into available information. 3. Data processing: filtering and smoothing processing. 4. Data storage: Save data to a file or database. 5. Real-time processing: Ensure the efficient and low latency of the code.

See all articles