mysql max pa,linux – MySQL:max_allowed_pa​​cket可能大于1 GB吗?

在改变

max_allowed_packet之前,首先让我们来定义它.

MysqL network communication code was

written under the assumption that

queries are always reasonably short,

and therefore can be sent to and

processed by the server in one chunk,

which is called a packet in MysqL

terminology. The server allocates the

memory for a temporary buffer to store

the packet,and it requests enough to

fit it entirely. This architecture

requires a precaution to avoid having

the server run out of memory—a cap

on the size of the packet,which this

option accomplishes.

The code of interest in relation to

this option is found in

sql/net_serv.cc. Take a look at my_net_read(),then follow the call to my_real_read() and pay

particular attention to

net_realloc().

This variable also limits the length

of a result of many string functons.

See sql/field.cc and

sql/intem_strfunc.cc for details.

根据本书的摘录和max_allowed_pa​​cket上的MysqL文档,对于max_allowed_pa​​cket而言,基本上没有什么可以超越1G.但是,还有一个方面需要探讨BLOB和文本数据调优.

关于InnoDB和BLOB,Another question in Server Fault做了以下断言:innodb_log_file_size和innodb_log_buffer_size组合必须大于你的最大blob对象的十倍,如果你有很多大的对象.如果你不这样做(并且你不应该[1,2]),那么真的没有必要用它来打扰.查看MysqL性能博客,获取有关如何计算的详细报告.

还有另一个需要考虑的方面:选项net_buffer_length(默认为16K)用作MysqL数据包的初始化大小.数据包可以动态扩展到max_allowed_pa​​cket.它不可避免地缩回到net_buffer_length指定的大小. net_buffer_length的最大值为1M.您可能希望将此值设置为1M.如果您正在驾驶1G,可能没多大帮助,但也不会有任何伤害.

如果你真的想要一个大于1G的MysqL数据包,我引用的那本书摘录告诉你使用什么源代码来定义MysqL数据包内部.您可以自由尝试提高限额.但是,如果代码假定1G除了设置显式数字之外,源代码可能具有自己的内部限制.

我希望这个信息有帮助!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值