Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Linux / Apache Server Stats. Is everything fine with the Server?

Posted on 2008-11-17
Medium Priority
Last Modified: 2013-12-16
We have recently migrated to LAMP Dedicated Server. Our application is a Online Travel Booking Engine made up of PHP, Javascript, XML, and MySQL. I am new to Linux Server and i have doubts that the Server dosnt scale well. Many a times when i open my site to test the response is very slow. I am looking for some information about:

1. How do i know how the Server is Performing under various load conditions.
2. How do i know my server can handle how many simultaneous users at a time.
3. Is the RAM sufficient? Curently i have 2 GB of RAM.
4. What i can do to make the server more Scalable.

Below are some figures i have got from the WHM.

Memory Information
Memory: 2073168k/2096896k available (1945k kernel code, 22768k reserved, 787k data, 204k init, 1179392k highmem)

Current Memory Usage
             total       used       free     shared    buffers     cached
Mem:       2074616    2017076      57540          0     103128    1628992
-/+ buffers/cache:     284956    1789660
Swap:      2096472       6492    2089980
Total:     4171088    2023568    2147520

Current Disk Usage
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             182G  9.5G  163G   6% /
/dev/sda1              99M   24M   70M  26% /boot
none                 1013M     0 1013M   0% /dev/shm
/usr/tmpDSK           485M   11M  449M   3% /tmp
/tmp                  485M   11M  449M   3% /var/tmp

Question by:Nabilbahr
  • 3
  • 2
  • 2
  • +1
LVL 10

Accepted Solution

nabeelmoidu earned 500 total points
ID: 22982312
Use ab to do a stress test on your site

 ab -kc 10 -t 30 http://localhost/

show the results

also do a top sorted with memory and ps aux

LVL 20

Assisted Solution

edster9999 earned 1000 total points
ID: 22982405
something like jmeter would be good for testing it under different loads
10 users, 20 user, 30 users upwards etc.

One thing that would be causing an issue here is the memory.
You have 2 GB but it is almost all used.

The first thing to drop is this :
none                 1013M     0 1013M   0% /dev/shm

This is a ram disk for passing data between your programs.  You have allocated it 1GB of your memory and you are not using it.

edit /etc/fstab and comment out the line with tmpfs or /dev/shm in it
then reboot and test again.


Author Comment

ID: 22983458
Thanks, edster9999 and nabeelmoidu.
Is it normal that Server is using all RAM available. We are not having too much traffic on site. Is it strange that Server is using 2GB whole.
edit /etc/fstab and comment out the line with tmpfs or /dev/shm in it
then reboot and test again.

For this do i have to contact my host or i can do it myself on WHM?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 20

Assisted Solution

edster9999 earned 1000 total points
ID: 22983903
you need to drop to command line and edit a file.
If you have a dedicated server they should have given you ssh access.
use that log in as root and edit /etc/fstab

Author Comment

ID: 22991171
Yes i have SSH access. After editing /etc/fstab, do i have to restart httpd or linux server?
LVL 20

Expert Comment

ID: 22992895
no need to boot just type
umount /dev/shm


Assisted Solution

macker- earned 500 total points
ID: 23001234
Yes, it's normal for the server to use all available RAM.  The amount of RAM being used under the "cached" column can be reclaimed at any time, and enhances performance of the server.

1. top, sysstat (sar), iostat, etc.
2. Load testing using benchmarking tools.  Which you use, depends on the target application, and who is writing the tests.  Once it starts being important enough to justify the cost, get a contractor to setup a benchmark suite for you.
3. Depends on how many users.  But RAM is cheap, and 2GB isn't much.  Install another 2GB for good measure, and plan on scaling to 16GB in the future.
4. Tune MySQL to use more memory.  There's some excellent tuning guides at MySQL.  This is the single biggest improvement you'll see.  You may also want to tweak the Min/Max spare servers settings, to better fit your load patterns.  But tweaking MySQL _will_ yield big improvements, probably what you're seeing the bottleneck on.

For MySQL, seriously consider switching from MyISAM to InnoDB.  You will take a big performance hit for this, but you'll gain a ton of reliability; can you afford to lose data?  Similarly, look into RAID 5 or RAID 10.  (Minimum 3 disks.)

For the MySQL engine, turn on query caching, set at least a 64mb buffer for it, and do the same for the key buffer.  From there, start reading the mysql tuning guides, and learn to read the stats, to make sure you're not adding too much memory.  Similarly, don't just increase the default buffers for queries; you may see short-term improvement, but sink the scalability.

Complex subject, and the amount of money on the line really dictates whether you should be asking here, or hiring someone to set things up for you.  If you're just trying to get a site off the ground, and traffic is still low, start with the global MySQL buffers.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will giveā€¦
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question