Tối ưu Apache để tiết kiệm CPU

Mặc định có thể bạn sẽ thấy Apache nó “ăn” hơi bị nhiều CPU do sử dụng quá nhiều process. Để thiết lập lại số lượng processes mà Apache được phép tạo ra, hãy mở file /etc/httpd/conf/httpd.conf lên và tìm đoạn:
01
02
03
04
05
06
07
08
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>
Ở đoạn trên, bạn sửa lại các phần thành những giá trị sau:
  • StartServers : 1
  • MinSpareServers : 1
  • MaxSpareServers : 5
  • MaxRequestsPerChild : 10000
Sau này nếu cần thêm VirtualHost, bạn chỉ cần copy file thachpham.dev.conf kia, đổi tên thành domain cần thêm cũng như sửa file để thay thachpham.dev thành domain mới của bạn.
Share To:

Post A Comment:

0 comments so far,add yours