Apache Preforkconfiguration

我是VPSconfiguration的新手。 所以,我已经安装了Apache,PHP和MySQL,现在我需要知道如何configurationPrefork来优化Apache。

The system configuration is: CPU Cores 2 x 2 Ghz @ 4 Ghz RAM Memory 2304 MB DDR3 Burst Memory 3 GB DDR3 Disk Space 30 GB SSD Bandwidth 3 TB SwitchPort 1 Gbps 

实际上,在linux,mysql,apache和php之后,有250MB内存在使用。

那么,我没有想法计算。 我在一些网站上看到了一些变数:

 KeepAlive On KeepAliveTimeout 1 MaxKeepAliveRequests 100 StartServers 15 MinSpareServers 15 MaxSpareServers 15 MaxClients 20 MaxRequestsPerChild 0 

要么

 StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 

我该怎么做:Prefork还是工人? 在哪里和如何放置variables? 在httpd.conf中?

这不能仅仅由硬件的规格决定。 有许多重要的事情,特别是你要服务的事情。

例如:

一个使用mod_php的网站应该使用prefork,因为PHP可能不是线程安全的。 如果你使用fcgi,你可以使用worker。 您是否在网站上使用了大量AJAX进行推送通知? 那么你可以设置一个非常高的MaxClient值。 但是您需要将其设置为低于Size Per Apache process * Clients约为22MB。 另一方面,如果服务大量静态内容,则可能不需要这么高的MaxClient。 还有备件。 你愿意有多less“热”?

性能问题不能这样回答。 更多这是一个不断的testing和学习。 拧紧螺丝,加油一切。

您应该使用Apache Bench等基准testing工具分析您的performance。 尝试不同的组合并testing它们。 这就是你如何得到你的configuration。