Skip to main content

my server is not optimize

Comments

7 comments

  • rackaid
    Due to stuck processes, you are filling up the connection queue in Apache. When this happens, web resources will not be available or will be very slow. This is controlled by the MaxRequestsWorkers value. (You may want to try 1024). If you look in the apache error log, you will see a warning if you are hitting the MaxRequestWorkers value. Why is this happening? The W's are usually due to PHP scripts waiting for something. The something can be difficult to identify but common items are:
    • Slow MySQL queries.
    • Slowly responding APIs.
    • Bad PHP loops that require a lot of processing.
    If you check the SS column the Apache Status page, you will see these process are running for a long time. When you see this, check to see if there is corresponding activity in the database. We once had a WordPress site have a transients issue where the table ballooned to >10M rows. A plugin was trying to run a poorly optimized query on the table. We were able to see the query by using MySQL's slow query logging feature. In addition to SQL issues, I have seen this when awaiting responses from 3rd party APIs. Slowly responding or blocked APIs can cause scripts to hang for 30s or more. Many apps do not set timeouts for these connections and in some cases, the timeout can be very long (minutes). As these build up, the Apache server stops responding. Debugging these issues can be difficult, but if you start tracing through the layers of your app, you can usually find the issue.
    1
  • ardimardiana
    thanks for quick response. i have change MaxRequestsWorkers to 1024. i never pay attention to SS header column before. tomorrow when server get heavy load i will take a note which process have a long timeout. maybe its good decision if i try to limit timeout every app to make sure server wont load too high. are bandwidth still related to my issue? since server try to sending a reply while bandwitdh can handle it? because at early this month we still use 20Mpbs but since 02-16 we have upgrade to 50Mbps yet i cant feel any difference with high server load. server hard to reach only from port 80 or 443. i mean when server on high load all website down. but not WHM.
    0
  • cPanelLauren
    You might also want to try running some benchmarking for apache using ab to determine what your needs will be in respect to that. ab - Apache HTTP server benchmarking tool - Apache HTTP Server Version 2.4 When you're seeing the high count of W which indicates= "Sending Reply" are you also experiencing errors in the apache error log or php-fpm specific error logs? If you were low on bandwidth I'd anticipate seeing a high count of "_" rather than "W" and if the timeout was the concern I would anticipate seeing a large amount of connections with "K"
    1
  • rackaid
    Bandwidth is not likely an issue. Don't mistake Sending Reply for the server actually sending data. Apache will be in the Sending Reply state as soon as the system processes the request headers and determines what response to send. In this case, you likely have apache waiting on a PHP app to send data. So the server is stuck in the Sending Reply state. Since the issue is due to a slow application, more bandwidth will not help. If bandwidth were the issue, you would see 100% max utilization of your network link.
    0
  • ardimardiana
    in addition to make my application faster, is there any suggestion about my php-fpm setting for php use all available resources to process my application faster? we will make comparison between application run in cpanel (for global access) and local access but still same database. currently in apache status still open just 10 server and child up to 250. even i have update my php-fpm as sugesstion to 1024.
    0
  • ardimardiana
    This ab for all user data with no lib (raw sql) framework lumens by laravel [user@user]# ab -n 500 -c 50 ???????_?????????_????????? Licensed to The Apache Software Foundation, This is ApacheBench, Version 2.3 <$Revision: 1843412 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, Welcome to The Apache Software Foundation! Benchmarking domain (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Finished 500 requests Server Software: Apache Server Hostname: domain Server Port: 80 Document Path: single_data Document Length: 1559 bytes Concurrency Level: 50 Time taken for tests: 0.283 seconds Complete requests: 500 Failed requests: 0 Total transferred: 877000 bytes HTML transferred: 779500 bytes Requests per second: 1766.40 [#/sec] (mean) Time per request: 28.306 [ms] (mean) Time per request: 0.566 [ms] (mean, across all concurrent requests) Transfer rate: 3025.66 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 1.0 0 5 Processing: 18 24 5.5 23 60 Waiting: 18 24 5.5 23 60 Total: 18 25 6.0 24 63 Percentage of the requests served within a certain time (ms) 50% 24 66% 25 75% 26 80% 27 90% 29 95% 36 98% 46 99% 57 100% 63 (longest request) still benchmarking some function with lib (datatables lib in lumen) With only return 3 row result [user@user]# ab -n 500 -c 50 ???????_?????????_????????? Licensed to The Apache Software Foundation, ???????_?????????_????????? Licensed to The Apache Software Foundation,
    0
  • ardimardiana
    Server Version: Apache/2.4.41 (cPanel) OpenSSL/1.1.1d mod_bwlimited/1.4 Phusion_Passenger/5.3.7 Server MPM: event Server Built: Jan 28 2020 19:40:24 Current Time: Sunday, 01-Mar-2020 23:08:56 WIB Restart Time: Sunday, 01-Mar-2020 21:15:20 WIB Parent Server Config. Generation: 1 Parent Server MPM Generation: 0 Server uptime: 1 hour 53 minutes 36 seconds Server load: 0.21 0.16 0.13 Total accesses: 15949 - Total Traffic: 1.1 GB - Total Duration: 31563742 CPU Usage: u82.62 s18.57 cu0 cs0 - 1.48% CPU load 2.34 requests/sec - 174.0 kB/second - 74.4 kB/request - 1979.04 ms/request 55 requests currently being processed, 120 idle workers Slot PID Stopping Connections Threads Async connections total accepting busy idle writing keep-alive closing 0 202209 no 2 yes 2 23 0 0 0 1 202210 no 3 yes 2 23 0 1 0 2 202211 no 8 yes 6 19 0 0 0 3 202212 no 4 yes 4 21 0 0 0 4 202213 no 12 yes 11 14 0 0 0 5 202487 no 8 yes 15 10 0 0 0 6 203843 no 9 yes 15 10 0 0 0 Sum 7 0 46 55 120 0 1 0 ___________________W__W_____W_________________W________W____W___ W_WW_W__________W________W__W_____W___WW_WW____W___W_W___WWWWWWW W_W___W__WW__W_W_WWWWW___WW_WWWWW___WWWW___WWWW................. .......................................................... Scoreboard Key: "_" Waiting for Connection, "S" Starting up, "R" Reading Request, "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup, "C" Closing connection, "L" Logging, "G" Gracefully finishing, "I" Idle cleanup of worker, "." Open slot with no current process this is my apache status while processing this ab [root@ptik ~]# ab -n 500 -c 50 ???????_?????????_????????? Licensed to The Apache Software Foundation, Welcome to The Apache Software Foundation! Benchmarking domain (be patient) Completed 100 requests Completed 200 requests Completed 300 requests apr_pollset_poll: The timeout specified has expired (70007) Total of 314 requests completed and our server is lag while processing this ab. [root@ptik ~]# ab -n 500 -c 50 ???????_?????????_????????? Licensed to The Apache Software Foundation, Welcome to The Apache Software Foundation! Benchmarking domain (be patient) Completed 100 requests apr_pollset_poll: The timeout specified has expired (70007) Total of 126 requests completed
    0

Please sign in to leave a comment.