5G内存的服务器如何配置Apache php mysql的内存分配

来源:百度知道 编辑:UC知道 时间:2024/05/22 13:20:11
服务器是双致强四核CPU,5G的内存,本人对大内存的服务器配置Apache php mysql的内存分配是个小白,请各位大侠现身赐教!拜谢了^_^
感谢一楼的朋友这么快就回答我,不过答案有些笼统,我希望php mysql的内存分配最好能有简单的配置单例如mysql的my.ini内容:

query_cache_size=32M

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=5M

以上可以类似可以自定义的内存设置改为多少合适,还有php的php.ini也要

需要通过性能监控,不断调整,每个机器的情况不一样,无法统一的。如果网络连接很多,还要调整TCP内核参数。

补充:
必须的调试的,举个极端的例子,假如你的数据库一般都比较空闲,那么完全可以使用最小化的控制,分配几M内存给MYSQL就行了。如果感觉机器的性能受数据库影响比较大,需要在MYSQL里面执行语句show status查看统计信息,根据实际情况调整各类BUFFER数值。