High load configuration

Discussion in 'Installation/Configuration' started by iceget, Jun 6, 2021.

  1. iceget

    iceget Member

    dear Community,
    Can any body help me;
    We have a new Server with 1 GBit uplink but I think our php or Webserver cobfig Is bad. We have a Website where about 3000 peoples (product launch) must be on the same site.

    How I can setup this Web for high load? Which configuration I should do?

    Clustering or load Balancing is not needed or?

    Last time the Server has no CPU load but where we had here the problems that the website is for about 10 min offline for much users. What's here the reason? We have WordPress and elementor in live with jo caching. Can anybody tells me which Problem can this be? Server load about 5 percent. Disk also u der 15 percent. Can it be that the Webserver is false configured? 3000 peoples should at the same time on the Page.

    Thank you so so much many greets
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Maybe the network has been overloaded? 1Gbit does not mean that much. Maybe get in touch with your provider?
     
  3. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Really hard to say. You need to set up monitoring to see what causes the being offline.
    Monitoring load, disk, memory, cpu, database, network etc. would help also in getting maximum performance of your system. Worth looking at is also the website, maybe it is slow and needs to be rewritten?
    You would need a test setup where you can create load for your website, to see if it can take 3000 simultaneous users. Using that test setup you could tune your system to get maximum performance.
    One way to be able to support 3000 users would be to create a static website. That should be the fastest you can get.
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    there's lots you can do to speed up a wordpress site. from the standard optimization and minifying.
    optimize images. use a cdn for static content, use cookie-free domains for static content.
    use eg varnish cache in front of wordpress, with full-page caching enabled.

    but as @Taleman states, to know if your site/server can handle a set number of simultaneous users, you're going to have to run some load testing and tuning, tuning would need to be applied to apache, php and mysql settings.

    other little things, depending on your server/vps hardware/configuration eg adding a separate disks / block devices for logs, for website files, for the database files etc. can all make small speed improvements, that collectively create a big speed/capacity increase.
     
  5. iceget

    iceget Member

    Thank you for all your inputs.
    I have no ordered a new Dell Server (Hetzner) with an 10G WAN Uplink and 6 SSDs with fast RAID Controller and Intel Xeon Gold.

    My Mainquestion;
    can i do a apache Configuration that maybe more connection can be allowed like the default one?
    i am using PHP Fast CGI (PHP 7.4). But i have read that we can improve or open the current limits for apache? last time i got "connection timed out" in the push phase where about 500 users was on the wordpress page with woocommerce shop. but no load. i attached here a photo from the linux server.
    can i do here improvements? apache or mysql connection limits or so? that i can add direct in the webhost configuration?

    thank you so much.

    many greets

    screenshots:
    [​IMG]
    http://raving.at/tmp/htop.jpg
    http://raving.at/tmp/top.jpg
    http://raving.at/tmp/vmware.jpg
     
    Last edited: Jun 8, 2021
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Personally, I would go for nginx for such highly used systems. Or does it has to be Apache?
     
    Jeremy007, ahrasis and florian030 like this.
  7. iceget

    iceget Member

    thank you till. no but how do change that? the system currently running with apache. but if it should be better i can do that with ngnix also. is there a good documentation how do migrate this system?

    thank you so much
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    I thought you are getting a new server, changing a running system is not that easy, so not sure if I would do that.
     
  9. iceget

    iceget Member

    yes till, but iam using vmware and move then the current linux server to the new server with the 10G Uplink and the fast SSDs + Intel Xeon Gold.
    Is there another possibility with e.g. the migration tool maybe? if i setup then a new server?

    thank you so much
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    With Wordpress and Nginx, you can do setups like this (might be possible with Apache too, not sure):

    1) Install cachify plugin in Wordpress. Memcached must be installed on the server.
    2) Configure cachify to use Memcached as backend.
    3) add this config in the nginx directives field of the website in ispconfig:

    Code:
    location / {
    
            client_max_body_size 100M;
    
            if ( $query_string ) {
                    return 405;
            }
            if ( $request_method = POST ) {
                    return 405;
            }
            if ( $request_uri ~ /wp-admin/ ) {
                    return 405;
            }
            if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
                    return 405;
            }
            error_page 404 405 = @nocache;
            #try_files /wp-content/cache/cachify/${host}${uri}index.html @nocache;
            default_type text/html;
            add_header X-Powered-By Cachify;
            set $memcached_key $host$uri;
            memcached_pass localhost:11211;
    
            ## PROTECT CACHE
            location ~ /wp-content/cache {
                    internal;
            }
    
            # Add trailing slash to */wp-admin requests.
            rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
            location ~*  \.(jpg|jpeg|png|gif|css|js|ico|ttf)$ {
                    expires max;
                    log_not_found off;
            }
    
            location ~ \.php$ {
                    try_files $uri =404;
                    include /etc/nginx/fastcgi_params;
                    {FASTCGIPASS}
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    #fastcgi_param PATH_INFO $fastcgi_script_name;
                    fastcgi_intercept_errors off;
    
                    fastcgi_temp_file_write_size 10m;
                    fastcgi_busy_buffers_size    512k;
                    fastcgi_buffer_size          512k;
                    fastcgi_buffers           16 512k;
                    fastcgi_read_timeout 1200;
    
            }
    }
    
    ## NOCACHE LOCATION
    location @nocache {
            try_files $uri $uri/ /index.php$is_args$args;
    }
    What this will do is that cached pages are stored directly in RAM of the server, nginx will then look up if a page is cached and server it directly from RAM, PHP is not even run for this request, if it's a cache hit.
     
    Jesse Norell and ahrasis like this.
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    This is a setup from one of my wp sites, so might need to be adjusted.

    What you must know, nginx is not as easy to use as apache, but it's faster in my opinion. Apache .htaccess rules must be converted into nginx settings, which means that sites that require such rules will not work out of the box. The above rules are for WordPress and cachify only.

    You can use the migration tool to move sites from an ispconfig apache to nginx system, but this will not solve the problem with the nginx directives as the tool can not automatically create them based on apache rules.

    If I remember correctly, Florian Schaal @florian030 has written a guide to convert an apache to nginx system that uses ispconfig.
     
    ahrasis likes this.
  12. florian030

    florian030 Well-Known Member HowtoForge Supporter

    This guide is quite old but it should give some hints.
     
    ahrasis likes this.
  13. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Make sure you also look at tuning mysql and php, and have ample php processes available.
     
    ahrasis likes this.
  14. iceget

    iceget Member

    dear community,

    i have now found this in my configuration:
    root@srv01:/etc/apache2/mods-available# cat mpm_worker.conf
    # worker MPM
    # StartServers: initial number of server processes to start
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
    # graceful restart. ThreadLimit can only be changed by stopping
    # and starting Apache.
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestWorkers: maximum number of threads
    # MaxConnectionsPerChild: maximum number of requests a server process serves

    <IfModule mpm_worker_module>
    StartServers 2
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadLimit 64
    ThreadsPerChild 25
    MaxRequestWorkers 150
    MaxConnectionsPerChild 0
    </IfModule>

    how can i increase the apache limits to about 5000 users?
    currently only 150 users can be on that server before the server closes the connection?

    how i can increase that? i have now a fast server.

    i want not change to ngnix this time, but want do performance tuning so that if we have a launch where about 3000-5000 users comes onto the wordpress site.

    can anybody tells me what is the best setup for that reason?
    and also for mysql i must increase the limits also, right?

    can anybody helps me that the apache webserver dosnt kill the connections?

    how i can increase them.

    thank you so much
     
  15. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    i believe that mpm_event is a bit faster / more resource efficient than mpm_worker, but i don't think there's a massive difference between them, that change certainly won't improve from 150 to 5000 users.

    you'd want to increase MaxRequestWorkers and ThreadsPerChild to increase concurrent users.
    you'd probably also want to change MaxConnectionsPerChild, not to increase the number of concurrent users, but to force a worker to be killed and recreated after a number of connections, to protect against a memory leak taking all available memory.

    but what you can set is ultimately determined by what you have available regarding cpu and ram.
    i would recommend you read this: https://www.liquidweb.com/kb/apache-performance-tuning-mpm-directives/


    ultimately, if you're looking at having that many concurrent users, especially if they're geographically diverse, i would look at implementing a CDN for all the static content, and at all the caching options available first.
     

Share This Page