database.yml中pool选项的用途是什么 [英] what is the use of the pool option in database.yml

查看:50
本文介绍了database.yml中pool选项的用途是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

database.yml中最广泛使用的选项如下:

Most widely used options in database.yml are of following :

adapter
encoding
database
pool
username
password
socket
host
port
timeout

我知道上面大部分内容的用法,但有池. 所以我想知道database.yml中pool选项的用途是什么,或者我们需要为流量非常大的应用程序设置任何其他参数.

I know the use of the most of the above but pool. So i want to know what is the use of the pool option in database.yml or there is any other parameter which we need to set for the application having very heavy traffic.

推荐答案

它设置每个红宝石过程可能的连接数量.因此,以防万一您正在使用Rails应用程序,或者您过度使用了事务.此处的限制取决于您的设置.考虑一下:

It sets the amount of possible connections per ruby process. So in case you are threading your rails app, or you use transactions excessively. The limits here depend on your setup. Consider this:

  • 50个红宝石工序
  • 每个具有100个线程
  • 设置为1000个同时连接的mysql

因此,每个进程在给定时间最多可以打开20个连接(50 * 20 == 1000)是有意义的.因此,您可以将pool值设置为20或更小.

so it makes sense that every process can open at most 20 connections (50 * 20 == 1000) at a given time. So you would set the pool value to 20 or less.

这篇关于database.yml中pool选项的用途是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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