Welcome to Centmin Mod Community
Become a Member

Install Does centminmod enforce limits on OpenVZ?

Discussion in 'Centmin Mod Insights' started by dorobo, Jun 23, 2014.

  1. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    3:46 PM
    latest
    latest
    I tested my WordPress sites (with WP Super Cache plugin) using blitz.io. They're hosted on a Ramnode OpenVZ VPS.

    I got timeouts and errors. So I was wondering if this code in nginx_install.inc

    Code:
    if [[ ! -f /proc/user_beancounters ]]; then
    cat >> "/etc/sysctl.conf" <<EOF
    # centminmod added
    net.core.wmem_max=12582912
    net.core.rmem_max=12582912
    net.ipv4.tcp_rmem= 10240 87380 12582912
    net.ipv4.tcp_wmem= 10240 87380 12582912
    net.core.netdev_max_backlog=8192
    net.core.somaxconn=8150
    net.core.optmem_max=8192
    net.ipv4.tcp_fin_timeout=20
    net.ipv4.tcp_keepalive_intvl=30
    net.ipv4.tcp_keepalive_probes=3
    net.ipv4.tcp_keepalive_time=300
    net.ipv4.tcp_max_syn_backlog=8192
    net.ipv4.tcp_sack=0
    net.ipv4.tcp_syn_retries=3
    net.ipv4.tcp_synack_retries = 2
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    vm.swappiness=20
    vm.min_free_kbytes=65536
    net.ipv4.ip_local_port_range=10000 65500
    EOF
    limits the number of connections for OpenVZ?


    edit: I think this is added for non-OpenVZ because I think you can't edit sysctl in OpenVZ. Am I right?
     
    Last edited: Jun 23, 2014
  2. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that is the limitation of OpenVZ virtualisation, you can't edit /etc/sysctl.conf

    hence why it's for non-OpenVZ only.

    if you want to be able to tune TCP and /etc/sysctl.conf, you'd need to use KVM or Xen based VPSes.
     
  3. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    12:46 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Hi there :)
    Well I am working on an OpenVZ VPS now and like you said, sysctl.conf can only work with KVM/XEN.
    Does that mean performance will not be the same?? (Consider we can not use sysctl.conf ??)
    Would you recommend switching to "unix socket instead of TCP" on OpenVZ ??

    And this for a high traffic site .... (I mean it may not have an issue for normal sites)
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    for OpenVZ performance depends on what the web host has customised/optimised at OpenVZ host node level

    as to unix socket vs TCP - theory is nice but in real world TCP scales better (when properly tuned) than unix sockets with less crashes for stuff like PHP-FPM
     
  5. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    2:46 AM
    latest
    10
    Interesting topic. I've been using openVZ on all mine and haven't noticed a difference at all - so if I used KVM/XEN - would difference would make in terms of speed and performance of the overall site(s)?
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    depends on the site.. when i mean performance I am talking about scalability and how many concurrent users you can handle (provided you properly tune for such which you can only do on Xen/KVM and not OpenVZ)

    Let's just say performance outlined at WordPress Super Cache Benchmarks (Blitz.io load test) 237 million hits/day would probably not be possible on standard OpenVZ VPS server versus a properly tuned KVM/Xen VPS server used for the blog
     
  7. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    2:46 AM
    latest
    10
    well, then. I learned something new today. So for a better performing site for high end traffic - it really needs the KVM/Xen to be able to fine tune the /etc/sysctl.conf to be able to accept high traffic without timeouts. But openVZ is good for small sites that don't get much traffic

    What would you say low -vs- high traffic would be with your Nginx? OpenVZ is able to handle a ball park figure of concurrent connections -vs- the KVM/Xen VM's

    Just trying to get an average or a best guesstimate
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    how long is a piece of string ? :)

    depends on web app used and how it's configured web app and server config wise.

    For serious site, I only would ever use KVM or Xen especially as Centmin Mod only auto implements some basic TCP tuned and optimised settings if it detects KVM or Xen or non-OpenVZ servers (dedicated servers non-virtualised). Centmin Mod skips any TCP optimisations if it detects OpenVZ VPS.
     
    Last edited: Feb 7, 2015
  9. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    12:46 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    What if I am the one who have access to host node as well?? Can I just copy those tweaks and add them there?
    Do need to point out that OpenVZ removed everything from sysctl.conf and added only what is needed for OpenVZ.

    Full Disclosure: I wanted to isolate few sites/projects so went with OpenVZ on dedicated server. (only 4 vps on decent spec server)

    I think this is the key here. Can I also read it like that "Unix socket may peform better out of the box without much tweaking for a "decent traffic site" ??
    And by that I mean a WP blog with 500 users at a time ?

    Again, I believe tuning is the key here. I do also think KVM/XEN may perform better with proper tuning but we need to into account OpenVZ is better (or faster) performance wize compare to the other two. I think if the server has enough power and tuning is done right (for all other parameters) we may not see a huge difference. KVM/XEN will still win thought but not with huge margin (But that's just IMO)

    Well I tried but KVM seemed too much of work ... OpenVZ was not only easy to implement but also lots of advantage for me. (being able to access vps from main node and backups)
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    I've never used OpenVZ host node so not sure on how it implements TCP tuned settings. As to unix sockets vs TCP, any decent traffic site will perform better with TCP in real life compared to unix sockets. Just try both and see for yourself :)

    Each his own, just for me I'll almost always choose KVM/Xen over OpenVZ for the best overall performance and scalability and being able to use more updated linux kernels when you need to :)
     
  11. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    3:46 PM
    latest
    latest
    sorry for reviving this thread but does the current centmin mod beta automatically tunes TCP and /etc/sysctl.conf in Dedi/KVM/Xen servers based on its specs?

    Much like how it detects the cores and puts the nginx workers automatically.
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,110
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    5:46 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes it does but only for some settings like /sys/module/nf_conntrack/parameters/hashsize and net.netfilter.nf_conntrack_max