forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com> Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
94 lines
9.6 KiB
HTML
94 lines
9.6 KiB
HTML
<a name="rds_faq_0055"></a><a name="rds_faq_0055"></a>
|
||
|
||
<h1 class="topictitle1">What Is the Maximum Number of Connections to an RDS DB Instance?</h1>
|
||
<div id="body8662426"><p id="rds_faq_0055__en-us_topic_0086557106_p8060118">RDS does not have constraints on the number of connections. This number is determined by the default value and value range of the DB engine. For example, you can set <strong id="rds_faq_0055__b726543865011">max_connections</strong> and <strong id="rds_faq_0055__b192489437502">max_user_connections</strong> in a parameter template to configure the maximum number of connections for an RDS for MySQL DB instance.</p>
|
||
<div class="section" id="rds_faq_0055__section394611138110"><h4 class="sectiontitle">Changing the Maximum Number of Connections</h4><p id="rds_faq_0055__p14965182520284">.</p>
|
||
<p id="rds_faq_0055__p1382955115120">You can change the maximum number of connections using commands.</p>
|
||
<ol id="rds_faq_0055__ol787713341185"><li id="rds_faq_0055__li15877123414182">Query the maximum number of connections.<p id="rds_faq_0055__p569163718181"><a name="rds_faq_0055__li15877123414182"></a><a name="li15877123414182"></a><strong id="rds_faq_0055__b43271223121810">show global variables like 'max_connections';</strong></p>
|
||
</li><li id="rds_faq_0055__li587718345181">Change the value of <strong id="rds_faq_0055__b1372815613136">max_connections</strong> under <strong id="rds_faq_0055__b4886759121316">mysqld</strong> in the <strong id="rds_faq_0055__b426542511415">my.cnf</strong> file.<p id="rds_faq_0055__p1319174141816"><strong id="rds_faq_0055__b74301527141812">[mysqld]</strong></p>
|
||
<p id="rds_faq_0055__p136029426184"><strong id="rds_faq_0055__b10455162713185">max_connections = 1000</strong></p>
|
||
</li></ol>
|
||
</div>
|
||
<div class="section" id="rds_faq_0055__section9718165216198"><h4 class="sectiontitle">Setting the Maximum Number of RDS for MySQL Connections to an Appropriate Value</h4><ul id="rds_faq_0055__ul7222346153012"><li id="rds_faq_0055__li20222946103018">In addition to the value of <strong id="rds_faq_0055__b1168823572218">max_connections</strong>, the maximum number of concurrent client connections allowed by MySQL is also limited by the maximum number of files that can be opened by a single process in the operating system. For example, if the maximum number of files that can be opened by each process is set to <strong id="rds_faq_0055__b245711124267">100</strong> in the operating system, the <strong id="rds_faq_0055__b9309152219389">max_connections</strong> parameter does not take effect even if it is set to <strong id="rds_faq_0055__b128361924182616">200</strong>.<p id="rds_faq_0055__p2161910623">Check the maximum number of files that can be opened by a single process in the operating system. The default value is <strong id="rds_faq_0055__b181751099380">1024</strong>.</p>
|
||
<p id="rds_faq_0055__p34300743010"><strong id="rds_faq_0055__b12167311123012">ulimit -n</strong></p>
|
||
<p id="rds_faq_0055__p172101320103818">The parameter <strong id="rds_faq_0055__b3740637192719">open_files_limit</strong> indicates the maximum number of files that can be opened by a single process, which is read from the operating system during MySQL startup.</p>
|
||
<p id="rds_faq_0055__p861311531263">Check the value of <strong id="rds_faq_0055__b11800114753114">open_files_limit</strong>.</p>
|
||
<p id="rds_faq_0055__p17164106211"><strong id="rds_faq_0055__b838893511308">show variables like 'open_files_limit';</strong></p>
|
||
</li><li id="rds_faq_0055__li3473125112341">Suggestions<p id="rds_faq_0055__p17162102025"><a name="rds_faq_0055__li3473125112341"></a><a name="li3473125112341"></a>The maximum number of MySQL connections can be customized provided that it is allowed by your instance specifications. The maximum number of connections is closely related to the instance memory. For details, see <a href="#rds_faq_0055__section164061146172516">About max_connections</a>.</p>
|
||
<p id="rds_faq_0055__p016310728">In actual scenarios, set the maximum number of connections to an appropriate value because more connections lead to large resource consumption.</p>
|
||
</li></ul>
|
||
</div>
|
||
<div class="section" id="rds_faq_0055__section164061146172516"><a name="rds_faq_0055__section164061146172516"></a><a name="section164061146172516"></a><h4 class="sectiontitle">About max_connections</h4><p id="rds_faq_0055__p1918020132154"><strong id="rds_faq_0055__b11988239132">max_connections</strong>: maximum number of clients that can be connected at the same time. If this parameter is set to <strong id="rds_faq_0055__b139511944205">default</strong>, it is related to the memory (unit: GB) of the DB instance. The calculation formula is as follows:</p>
|
||
<p id="rds_faq_0055__p4501159152414"><strong id="rds_faq_0055__b1337716401454">Estimated value of <span id="rds_faq_0055__ph64351744143417">max_connections</span> = Available node memory/Estimated memory occupied by a single connection</strong></p>
|
||
<div class="note" id="rds_faq_0055__note2290928192615"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="rds_faq_0055__ul6247124218266"><li id="rds_faq_0055__li1524714212615">Available node memory = Total memory – Memory occupied by the buffer pool – 1 GB (mysqld process/OS/monitoring program)</li><li id="rds_faq_0055__li12173104419262">Estimated memory usage of a single connection (single_thread_memory) = thread_stack (256 KB) + binlog_cache_size (32 KB) + join_buffer_size (256 KB) + sort_buffer_size (256 KB) + read_buffer_size (128 KB) + read_rnd_buffer_size (256 KB) ≈ 1 MB</li></ul>
|
||
</div></div>
|
||
</div>
|
||
<p id="rds_faq_0055__p1699995413263">The following table lists the default values of <strong id="rds_faq_0055__b8910451101211">max_connections</strong> for different memory specifications.</p>
|
||
|
||
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="rds_faq_0055__table167335205291" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Max_connections for different memory specifications</caption><thead align="left"><tr id="rds_faq_0055__row273372012295"><th align="left" class="cellrowborder" valign="top" width="46.78%" id="mcps1.3.6.2.3.1.1"><p id="rds_faq_0055__p51186704165712"><strong id="rds_faq_0055__b16913205614139">Memory (GB)</strong></p>
|
||
</th>
|
||
<th align="left" class="cellrowborder" valign="top" width="53.22%" id="mcps1.3.6.2.3.1.2"><p id="rds_faq_0055__p52482393165712"><strong id="rds_faq_0055__b3382126101420">Connections</strong></p>
|
||
</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr id="rds_faq_0055__row8205956376"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p16552181015310">512</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p14345145216293">100,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row167551215173717"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p873462012910">384</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p11345195222919">80,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row1392813153815"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p173462017290">256</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p934525212918">60,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row722119406210"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p178589411923">128</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p88582411126">30,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row14593122933812"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p917217512331">64</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p53459527299">18,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row3419121033810"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p273419206296">32</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p834575215297">10,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row17733122042916"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p187331420152920">16</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p5345135219291">5,000</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row14109145020389"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p16578142103315">8</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p195786273311">2,500</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row20583182273815"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p20734102072911">4</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p16345852132918">1,500</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="rds_faq_0055__row19733132010292"><td class="cellrowborder" valign="top" width="46.78%" headers="mcps1.3.6.2.3.1.1 "><p id="rds_faq_0055__p1973312017299">2</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="53.22%" headers="mcps1.3.6.2.3.1.2 "><p id="rds_faq_0055__p11345252102912">800</p>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="rds_faq_0141.html">Database Connection</a></div>
|
||
</div>
|
||
</div>
|
||
|