Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I`m new in LAMP. I Install an Ubuntu-Server with Mysql, Apache. Every thing is good until requests up to 10000 on web server in a day. After that server down and not work. Is there any role for estimating hardware requirements? should I configure Apache or Mysql?

share|improve this question

closed as not a real question by mailq, Iain, Scott Pack, Ward, Chris S Nov 10 '11 at 16:38

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is that 3000 users or 3000 requests and in what period of time? Every second or every day? You may need to examine where the bottlenecks are, I would hazard a guess at badly optimised SQL (and PHP?) –  Jaydee Nov 10 '11 at 13:05

3 Answers 3

You don't really give us much information to work with. 10000 requests/day is 1 request every 9 seconds. Pretty much any hardware/vps you can get today (and even TomTom's smartphone) should be able to handle that. Whatever your problem is it's unlikely to be hardware. If you look over on the right of the screen ---> under Related you'll find a bunch of questions with answers that should help you narrow down where your problem lies.

share|improve this answer

straight answer: at 3k concurrent requests it's no children playground anymore. get a good system administrator who can trace the bottlenecks and fix'em. usually this will translate into a modified system design/architecture but if you are lucky it's just about a badly written (probably php) application, missing mysql indexes, poorly configured apache.

long and far from complete answer, blindly trying to put you on the right path:

  • estimating hardware requirements: capacity planning is a long story. if you want to doit right you are in need of reading a good book on systems architecture and capacity planning
  • you surely must revisit apache and mysql configurations. the ubuntu default configurations are far from production-ready quality. disable keepalives, increase number of children processes, disable dns lookups and many more...
  • don't run a threaded apache with mod_php; php modules are usually NOT written with thread safety in mind; always use preforked apache with mod_php
  • try to use a memcache somewhere in the path. see if your apps have memcache support
  • make a rule of thumb from separating static content on another http service (nginx, lighttpd)
  • you can eventually use php under a fastcgi server; php 5.3 comes with a fastcgi server; if you do that, you can use a faster http server as fronted and drop apache for good (nginx comes with good fastcgi client support)
  • use APC with php
  • log slow mysql queries; make sure you have the right indexes for the queries marked as slow by mysql

much more to say, a sysadmin can write a book on the path one must take to transform a dummy LAMP ubuntu install into a production-ready, fast, scalable.... i'll stop here.

share|improve this answer

You need to tune all of three : Hardware requirements: Indeed, the hardware is the first thing you should be concerned. there are two types of content, served by Apache, Static and Dynamic. in case of static, Apache can easily server more than 2000-3000 requests easily with tuned performance of Apache, on hardware with following specifications: Corei3 2.13Ghz processor, 4GB RAM. but in case of Dynamic content, the real game begins. PHP based dynamic pages require a lot of memory and CPU resources., which i will explain in their respective sections below.

Apache: the performance of apache can tuned easily by changing many of its parameters. for example, these are some of the runing parameters for my wordpress hving huge traffic on it.

Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 6
####Maximum Client Connections
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      512
MaxClients       512
MaxRequestsPerChild  4000
</IfModule>

Every apache process takes about 10-30MB (can be huge in case of heavy php page) of space to serve php requests. Formula to find maxclients is:

MaxClients ≈ (RAM - size_all_other_processes)/(size_apache_process) for detailed and step by step process of tuning apache for php, please follow this article: Apache performance tuning

MySQL:

For mySQL: add following to my.cnf

query_cache_type = 1

query_cache_size = 26214400

which makes dramatic boost in performance. Also look at this article, which explains "What to tune in MySQL Server after installation" http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/

share|improve this answer

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