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

We are currently running a Perl web application on top of Apache 1.3 (I know this is seriously outdated but there is nothing we can do about it at this time). Throughout the day, as the number of users accessing the application increases, the server becomes less and less responsive until it eventually becomes unavailable. At this point we stop the Apache server until there are no active connections and then the server is restarted. This is far from an ideal solution and doesn't resolve the underlying issue.

What can we do to find the root cause of our problem and what can we do to resolve the issue in the short and long term?

share|improve this question
    
Are you invoking the Perl script through CGI or mod_perl? –  Marcin Nov 29 '10 at 14:47

2 Answers 2

Some general ideas:

  1. Use "top" and "free" to check the status of your server during times of high load. Typically the bottleneck will be one of CPU, Memory, or IO but there may be a specific issue with your app/setup as well (e.g., deadlock issues when the number of concurrent users increases).
  2. If the issue is memory (especially if it starts to page to swap) then you can either add more RAM or remove any unnecessary modules from Apache. The default config usually loads everything which makes Apache consume a lot of memory per client. Although this may seem unintuitive, you can also reduce the number of MaxClients to prevent Apache from using so much memory that it starts to swap.
  3. If the issue is CPU you can either look at getting a more powerful server or try to optimize your application. I'm not familiar with Perl but with PHP installing an opcode like APC reduces the CPU by caching the compiled PHP scripts. Similarly, installing a caching layer like Squid or Nginx may help to reduce requests the Apache/Perl layer depending on what is cacheable in your case.
  4. IO issues can be dealt with getting faster disks and/or setting up RAID (the kinds for improving performance). Adding a caching layer and/or increasing memory may also help reduce the IO load by keeping more of your app in memory and having to touch the disk less.
  5. Unless the issue is merely a misconfigured Apache or application your "best" solutions may be to investigate adding some caching or moving to a more powerful server depending which is easiest for you to do.
share|improve this answer

It seems that you have scalability issue. You have two options:

1- Upgrade your server specs by adding more CPU, RAM, etc. This option may be expensive and not scalable enough for the long-term. Also, it is very recommended that you have another server to remove the single point of failure.

2- Add more servers and use a load balancer to distribute the load among all the servers. This option may be better than the previous one for availability issues especially if you currently have only one web server. Adding more servers provides more scalability in the long-term and it can be done using multiple not-so-expensive hardware.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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