创建数据库连接昂贵吗? [英] Database connection expensive to create?

查看:95
本文介绍了创建数据库连接昂贵吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么创建数据库连接昂贵?就像确切地消耗什么有限资源(带宽/网络往返/ cpu)?

Why is database connection expensive to create ? Like what finite resource (bandwidth/network round trip/cpu) exactly is it consuming ?

创建起来通常很昂贵,这意味着它正在消耗一些资源,例如cpu / disk / io,但是在连接的情况下,我只能想到Sync / Ack花费的时间等等。

Typically expensive to create means it is consuming some resource like cpu/disk/io, but in case of connection i can only think of the time it takes for Sync/Ack etc.

推荐答案

您没有说您要查询的数据库,所以这个答案很普通。

You didn't say what database you are asking about, so this answer is pretty generic.

数据库连接不仅仅是一个TCP / IP套接字。每个连接都消耗将用户与数据库中的各种资源相关联的内存。它可能会耗尽共享内存池中的一些内存块,等等。仅授权连接将运行多个查询,具体取决于连接字符串。首先,将对用户进行身份验证。如果指定了初始目录,则还将执行授权。而且,如果正在进行某种审核,则连接将记录在某处。

Database connections are much more than just a TCP/IP socket. Each connection consumes memory that associates the user with various resources in the database. It will likely use up some memory blocks from a shared memory pool, etc. Just authorizing the connection will run several queries, depending on the connection string. First the user will be authenticated. If an "initial-catalog" is specified, then an authorization will be performed as well. And if there is some sort of auditing going on, then the connection will be logged somewhere.

这篇关于创建数据库连接昂贵吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆