Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33
  1. #26
    Accidental post in wrong thread
    Last edited by telvps; 03-07-2011 at 09:36 PM. Reason: Accidental post in wrong thread

  2. #27
    I've a read on your tutorial and its just awesome i can say, you done good job.

  3. #28
    heres full post

    With a considerable number of webmasters switching to Virtual Private Servers (VPS) from shared hosting these days and preferring them over costlier fully dedicated servers, memory and resource optimization has become a burning issue. Most VPS packages being bought these days, have dedicated memory constraints of 128MB to 256MB. Apache and MySQL are known to be the most memory (resource) intensive applications that tend to crash or slow down a low to mid range VPS often. While OpenVZ or Virtuozzo based VPSs can have a burst memory limit in addition to the dedicated RAM to quench occassional high memory needs, Xen based VPSs cannot use more than the stipulated amount of dedicated RAM, adding to the problem.

    In this short do-it-yourself Apache and MySQL optimization guide, I will present some small yet useful tips that I have collected from the net and will also share my own VPS settings and experiences that I hope would be very useful to first time and newbie VPS owners. I would also like to make it clear that I’m not a system admin or server guru of any caliber, but a techie and geek who loves to try and do things himself. So, always make a backup of files concerned and don’t hold me responsible for any kind of loss incurred. Try at your own risk!

    My VPS Specifications

    CentOS 4.4 OpenVituozzo based.
    256MB Guaranteed RAM, Upto 512MB burst.
    4 VPSs on a Celeron 2.53 ( ~625 MHz Guaranteed CPU, 2.53 Burst ).
    Apache 1.3.37, PHP 4.4.4, MySQL 4.1, VM-POP3, Exim.
    DirectAdmin Control Panel ( 1.2.6 ) - Known for its resource friendliness and quite cheap yet effective.

    My Own Optimizations

    Note : The optimizations below are based on this platform. However, they should work fine for 128 to 384 MB Guaranteed RAM. Consult a professional system admin if you want the best optimizations for your VPS ( and be ready to shell out some 10s of dollars )

    First of all, login as root user to your VPS over SSH.

    Apache Optimization

    1. Make a back up of your httpd.conf first. It’s generally found at /etc/httpd/conf/httpd.conf
    Your path may differ…so ‘locate’ or ‘whereis’ commands should be your friend.

    2. Open it up using a text editor. ( eg - ‘nano’ )

    3. Make the following changes : ( you’d find these near the start )
    Timeout 200
    KeepAlive On
    MaxKeepAliveRequests 200
    KeepAliveTimeout 3
    MinSpareServers 5
    MaxSpareServers 15
    StartServers 5
    MaxClients 20
    MaxRequestsPerChild 2000
    HostnameLookups Off

    4. Save and exit editor.

    MySQL Optimization

    1. First backup and then open /etc/my.cnf in a text editor.

    2. Delete everything and then add the following to it :

    [mysqld]
    max_connections = 400
    key_buffer = 16M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 1024
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 1000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 1M
    query_cache_size = 16M
    query_cache_type = 1
    tmp_table_size = 16M
    skip-innodb
    [mysqld_safe]
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout

    3. Save and exit.

    Restart Apache and MySQL

    Based on your Operating System, the commands may differ.
    On CentOS, type :

    /sbin/service httpd restart
    /sbin/service mysqld restart

    Your control panel ( DirectAdmin, cPanel and so on ) may also have options to restart the above processes.

    Closing Notes

    Every VPS is different than the other, even if the basic specifications are same. Feel free to play around the settings I suggested and lock on the best values you deem fit.

    It’s always better to go for a VPS provider who has good reputation for after sales support and not an overseller. Costly is not always good and cheap is not always bad. Hunt for reviews, feedback in hosting forums before buying. Remember : “You get what you pay for”!

    Keep in mind that most VPSs are used like full dedicated servers and the owner often expects it to perform like a dedi box, which is simply not possible. Web, mail, ftp and so on are often loaded onto a low to mid range VPS. Resources are scarce…so optimization is the key.

    For VPSs below 384MB of RAM, it’s wise to choose DirectAdmin as control panel. It’s highly feature rich yet cheap. Consumes lot less memory than cPanel and Plesk.

    For 128MB VPSs, if you find the memory still low after applying my settings, try lowering MinSpareServers , MaxSpareServers , StartServers , MaxClients and MaxRequestsPerChild in small, proportional steps and lock on the optimum value.

    For 256MB to 384MB VPSs, if you find a lot of memory being unused ( type ‘free’ ) after 2 days of optimization, try increasing the values of the settings in the above line proportionately.

    If you find that this isn’t working for you or you aren’t satisfied, just restore the files you backed up and restart the processes.

  4. #29
    Join Date
    Jul 2003
    Location
    Virginia, USA
    Posts
    28
    Excellent guide! Thanks for sharing/re-posting this. I'm keeping this thread bookmarked for future reference

    Thanks again!

    -James

  5. #30
    I'll try it on my new box, thanks for sharing

  6. #31
    the link is down? but thanks for the repost onelove

  7. #32
    in my VPS it looks different. hope i should look it more deeper.

  8. #33
    Join Date
    Jun 2010
    Location
    Java Island
    Posts
    147
    report: the link is down, bro.

    I usually tune my mysql configuration by using mysql tuning primer, script is downloadable from here https://launchpad.net/mysql-tuning-primer/
    <<please see forum rules for signature formatting guidelines>>

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •