MySQL 服务器的 thread_stack 参数 - 它是什么?应该有多大?
几天前我从 MySQL 数据库中收到以下错误:
Couple days ago I got following error from MySQL database:
线程堆栈溢出:196608 字节堆栈中使用了 68744 字节,需要 128000 字节.使用 'mysqld -O thread_stack=#' 指定更大的堆栈.
Thread stack overrun: 68744 bytes used of a 196608 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack.
我找到的所有文档都说:
All documentation that I found says, that:
MySQL 4.0.10 之前的默认值为 64KB,之后为 192KB.如果线程栈太小,会限制服务器可以处理的SQL语句的复杂度、存储过程的递归深度以及其他消耗内存的操作.
The default is 64KB before MySQL 4.0.10 and 192KB thereafter. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.
我将变量 thread_stack 设置为 256K,但这只是一个随机值.现在它解决了这个问题,但我真的很想知道它应该有多大,获取一些示例值或用法.例如:
I set the variable thread_stack to 256K, but it was just a random value. For now it solved the problem, but i'd really like to know how big should it be, get some example values, or usages. E.g.:
- 使用 96KB (x KB) 的线程堆栈可以做什么和不能做什么?
- 如何计算我需要多大的线程堆栈?
推荐答案
今天刚遇到类似的错误.关于变量的 MySQL 文档提供应该足够的默认值的提示(32 位系统为 192K,64 位系统为 256K),以及查看 MySQL 基准测试套件.
Just ran into a similar error today. The MySQL documentation about the variable provides a hint for default values which should be enough (192K for 32 bit systems and 256K for 64 bit systems), as well as to look at the MySQL Benchmark suite.
相关文章