Find the answer to your Linux question:
Results 1 to 5 of 5
Hello My friend's LAMP application is still sluggish, even though he now has two Apache servers connecting to a shared MySQL server. Since his "top" and "vmstat"* don't seem to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2007
    Posts
    127

    Question Checking network I/O?


    Hello

    My friend's LAMP application is still sluggish, even though he now has two Apache servers connecting to a shared MySQL server.

    Since his "top" and "vmstat"* don't seem to show issues with CPU, RAM, or disk I/O, I assume the issue is due to either network I/O, as-is or masking as disk I/O while waiting for MySQL to respond.

    How should I investigate if it's indeed due to network latency?

    Thank you.

    * here are the outputs of "top" and "vmstat":
    Code:
    top - 23:46:32 up 22 days,  7:29,  3 users,  load average: 1.06, 1.57, 1.80
    Tasks: 113 total,   1 running, 112 sleeping,   0 stopped,   0 zombie
    Cpu(s):  6.5%us,  2.9%sy,  0.0%ni, 90.2%id,  0.2%wa,  0.0%hi,  0.2%si,  0.0%st
    Mem:   2070684k total,  1987760k used,    82924k free,    56972k buffers
    Swap:   361448k total,        0k used,   361448k free,  1025292k cached
    
    vmstat 5 5
    procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
     0  0      0  80924  57464 1026020    0    0     2     3    4    0 18  8 74  0
     1  0      0  80096  57504 1026160    0    0     0   130 1925 5290 28 11 61  0
     0  0      0  80172  57520 1026060    0    0     2   129 1878 4687 27 17 56  0
     4  0      0  80056  57536 1026072    0    0     0   127 1742 3790 45 21 34  0
     2  0      0  80476  57560 1026108    0    0     0   137 2415 4071 46 20 34  0

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,756
    Latency and bandwidth are two different things.

    If all machines are on a local 100Mbit network, response times to ping should be sub 1-2 msec - and *no* drops.

    Bandwidth tool = IPerf

    Code:
    netstat -in
    will show receive/transmit errors/drops. Should be almost 0 or nearly 0 when statistically compared to the RX/TX OK's.

    What if Apache is serving static pages? Are there any issues then? If not, and the network is fine, then you know it's related to executing the php/cgi on the webserver and/or running the query in MySQL. You could also create php/cgi that does something locally (opens a text file, makes some changes, displays some result) to confirm php/cgi on the webserver is solid.

    Firewall/iptables enabled? Name lookups that are hanging/timing out? The list goes on and on...

  3. #3
    Linux Newbie
    Join Date
    Nov 2007
    Posts
    127
    Thanks much for the help. The latest "top"...

    Code:
    top - 18:55:06 up 24 days, 1:40, 2 users, load average: 34.86, 97.55, 109.01
    Tasks: 645 total, 3 running, 641 sleeping, 0 stopped, 1 zombie
    Cpu(s): 45.6%us, 14.1%sy, 0.0%ni, 20.0%id, 17.4%wa, 0.4%hi, 2.5%si, 0.0%st
    Mem: 2070172k total, 1714640k used, 355532k free, 88112k buffers
    Swap: 998376k total, 295900k used, 702476k free, 467308k cached
    nestat -in :

    Code:
    Kernel Interface table
    Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
    eth0 1500 0 421087233 0 660 0 308494170 0 0 0 BMRU
    lo 16436 0 203900884 0 0 0 203900884 0 0 0 LRU
    lo:0 16436 0 - no statistics available - LRU
    I asked the admin to install and run "iostat" and find out how to check load on the MySQL server.

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    If it were me I would be questioning the RX-DRP's.
    Check the interface a few time when your friend is seeing issues to see if this number goes up.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  5. #5
    Linux Newbie
    Join Date
    Nov 2007
    Posts
    127
    Thanks for the tip. I also wondered if it meant anything, so I googled for "netstat dropped packets". It looks like it could be a sign of lack of memory, which would be coherent considering the load this server is under.

    To tell where the issue is, I asked him to serve 1) static files, then 2) non-DB-bound PHP pages, and then finally 3) PHP pages with MySQL queries, to see if we can spot what is causing such huge load between Apache, PHP, and MySQL.

    This is a Web 2.0-type social site with every single page making queries to the MySQL server, but currently, at most, about a thousand users are actively accessing the site.

    People tell me he shouldn't need that much hardware (currently two Apache servers with one acting as load balancer and both having a copy of static files, and a second server acting as MySQL), and the application is likely not written as it should be.

    Thank you.

Posting Permissions

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