# Optimal Memory settings

**URL:** <https://forums.percona.com/t/optimal-memory-settings/237>\
**Category:** Other MySQL® Questions\
**Created:** [March 10, 2007, 5:24pm UTC](https://forums.percona.com/t/optimal-memory-settings/237 "2007-03-10T17:24:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aronrosenberg](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aronrosenberg](https://forums.percona.com/u/aronrosenberg)\
**Post date:** [March 10, 2007, 5:24pm UTC](https://forums.percona.com/t/optimal-memory-settings/237/1 "2007-03-10T17:24:08Z")

</div>

So we have been getting sig 11 crashes with our 5.0.36 mysql setup with the last query that runs before it crashes returning: Can’t create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug

This makes me suspect that we have misconfigured our memory settings in my.cnf

The manual states that you should follow this rule.

key\_buffer\_size + (read\_buffer\_size + sort\_buffer\_size)\*max\_connections = mem\_used

We run an entirley innodb load (except mysql table itself) so I figure this calculation needs to be modified to take into account the various innodb memory spaces.

Does this appear to be proper formula to use with innodb:

innodb\_buffer\_pool\_size + innodb\_additional\_mem\_pool\_size + key\_buffer\_size + innodb\_log\_buffer\_size + (read\_buffer\_size + sort\_buffer\_size + join\_buffer\_size + read\_rnd\_buffer\_size)\*max\_connections = mem\_used

Does the read\_buffer\_size and sort\_buffer size matter to innodb?

---

<div class="post-metadata">

**Author:** ![sterin](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@sterin](https://forums.percona.com/u/sterin)\
**Post date:** [March 15, 2007, 6:04pm UTC](https://forums.percona.com/t/optimal-memory-settings/237/2 "2007-03-15T18:04:16Z")

</div>

The read\_buffer\_size and sort\_buffer\_size do apply even though you are using InnoDB.

The read\_buffer is used when a query has to performa a sequential scan of a table and is not bound to a specific storage engine.

The sort\_buffer is always used for cases when you have an ORDER BY or a GROUP BY where it needs to perform a sort of the data to perform these operations.

And yes I think that your formula is pretty accurate.

But if you get these strange out of memory errors. Remember that sometimes you have ulimit settings that limit the memory that a single process is allowed to use.

That has been a problem for several people before you.
