I have an apache/ubuntu server serving a php website. Its 2gb/ram. Google Analytics is showing 4 users online but my network I/O is at 8/mb sec and CPU close to 100%.

Where should i start looking for the problem?

  • what do you mean "network I/O is at 8/mb sec and CPU close to 100%" ?? where do you observe that ? – krisFR Dec 10 '13 at 23:57
  • top to see whats eating CPU and netstat -tp to see active connections – xeon Dec 11 '13 at 0:01
  • Google Analytics doesn't get triggered by clients not running javascript. If your site is getting crawled by a bot for example. – Zoredache Dec 11 '13 at 0:11
  • Check the logs on your server or other monitoring tools you have available. – Drew Khoury Dec 11 '13 at 1:53

Your question is a little vague but let me see if I can give you a hand with some basic diagnostics.

Install a couple things:

  1. Open up a terminal
  2. Install htop (will show you which processes are using your cpu): sudo apt-get install htop
  3. Install nethogs (will show you which processes are gobbling up your bandwidth): sudo apt-get install nethogs

Run htop

  1. Press F6 to sort, you'll see a little menu come up on the left side of the terminal window.
  2. Use your up and down arrows to select CPU%.
  3. You should then see a list of the process burning up your CPU.

Run nethogs as root

  1. Depending on how your server is connected to the internet, what you type below might differ slightly. I'll assume you're using a regular ethernet connection.
  2. type sudo nethogs eth0
  3. You should see a display of the processes using bandwidth, ranked by their usage.

If you don't see that list and there's an error about eth0, we just have to figure out what kind of device you're connected through

  1. Figure out your ip address
  2. Type ifconfig into the terminal and then look for your ip address and see which device coincides with it

For example mine might look something like below. If I was looking for my local ip address, I'd see that it's under wlan0. I would then run sudo nethogs wlan0.

    me@mycomputer:~$ ifconfig
    eth0      Link encap:Ethernet  HWaddr 50:50:50:50:50:50  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:41 Base address:0xc000 

    lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:174495 errors:0 dropped:0 overruns:0 frame:0
          TX packets:174495 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:34273278 (34.2 MB)  TX bytes:34273278 (34.2 MB)

    wlan0     Link encap:Ethernet  HWaddr 78:44:76:93:e0:19  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::fe80:fe80:fe80:fe80/64 Scope:Link
          RX packets:8745176 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4565824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10226861873 (10.2 GB)  TX bytes:519927133 (519.9 MB)

If that trick doesn't work for you, you might try the following shots in the dark

  • sudo nethogs wlan0 (if wireless)
  • sudo nethogs eth0
  • sudo nethogs venet0:0

Anyway, hope this helps you identify what's causing trouble.

In the future when asking questions, you might give us clues as to what you've tried, what you think your struggling with or how much you know about the subject at hand.

  • thanks for taking the time to answer. a lot of people dismissed the questions because it was too simple, but we all have to learn something for the first time! – Rafa Tost Dec 11 '13 at 6:51
  • Hah, tell me about it! Best of luck to you. – neanderslob Dec 11 '13 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.