Mysqld-nt:out of memory (Needed 1677720 bytes) workaround

Source: Internet
Author: User
Tags php error vps server memory

Http://www.jb51.net/article/58726.htm

Today found that the site is a bit slow, found in the MySQL log hint mysqld-nt:out of memory (Needed 1677720 bytes), after the troubleshooting is due to the recent adjustment of MySQL some parameters caused, thought the memory is not afraid of the large, 32-bit system real content utilization is very low, it is said that no more than 4G, our 32G memory is really wasted, or later use win2008 R2 or CentOS system to do the server bar. Not much nonsense to say below for everyone to share the following solution:

Because the MySQL version may be slightly different configuration, the main is to set the following parameters

Key_buffer, Key_buffer_size, Read_buffer_size, sort_buffer_size Remember that this parameter is changed, and do not add. After the change is generally reduced, and then restart the MySQL service.

Core tip: Check mysqld configuration my.conf, focus on Key_buffer_size, Max_heap_table_size, tmp_table_size several parameters, recommended setting key_buffer_size value for Max_heap _table_size of the 1/4.

Because the server memory and large surplus more, the previous days to my.conf several parameters to adjust a considerable, 1G or even 2G, but not stable, MYSQLD reported several times out of memory (Needed xxx bytes) Such errors, analysis of the reasons, Think that Linux on the 32-bit Linux system does not support PAE, can not use more than 3G of memory, so the modification of a few parameters appropriate to the small point, the maximum is only hundreds of m, but there have been several times out of memory errors. So online multi-query, and later by the formula

Key_buffer_size + (read_buffer_size + sort_buffer_size) *max_connections

The inspiration, two times checked the key_buffer_size, max_heap_table_size, tmp_table_size several parameters, found that the three values of the settings are the same, unexpectedly are 512m!

So the small key_buffer_size to 128M, restart mysqld the next 5 hours of monitoring, no more similar errors occurred.

After changing these several parameters, or there is an out of memory, continue to check, found innodb_buffer_pool_size = 1512M, so I changed to 1000M, and then restart MySQL incredibly good.

Note: This server has a total of 3G memory: The final size is as follows

Key_buffer = 200M
Key_buffer_size = 1294963200
#max_join_size = 4294967295
Max_join_size = 1294967295
Max_allowed_packet = 1M
#table_open_cache = 512
Table_cache = 512
Sort_buffer_size = 2294967295
Read_buffer_size = 2147479552
#write_buffer_size = 4294967295
Read_rnd_buffer_size = 4M
Myisam_sort_buffer_size = 64M
Thread_cache_size = 8
Query_cache_size= 16M

PHP error fatal Error:out of memory (allocated 262144) (tried to allocate 19456 bytes

PHP has been running for some time after an error occurred:

PHP error fatal Error:out of memory (allocated 262144) (tried to allocate 19456 bytes

This means: fatal error, exceeding memory, already allocated allocated 262144, attempt to allocate 19456 bytes.

The workaround is to modify the php.ini and increase the Memory_limit

Just really scared me, HTML can be normal access, PHP No, I thought it was under attack.

Later saw www.blogguy.cn not go to the fatal error:out of memory (allocated 262144) (tried to allocate 19456 bytes, know that the memory is not enough to cause, but the VPS is not even up, Also can not see who in the end is the memory, only into the site backend restart VPS, do not know where the problem. Record it down for filing!

Modify method

Modify PHP.ini

Below the area

Max_execution_time = 120; Maximum execution time of each script, in seconds
Max_input_time = 60; Maximum amount of time each script may spend parsing request data
Memory_limit = 64M; Maximum amount of memory a script may consume (64MB)

Adjust as needed.

Just restart Apache for a second.

Mysqld-nt:out of memory (Needed 1677720 bytes) workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.