0

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?

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
purinkle
  • 113
  • 4

2 Answers2

1

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.
uesp
  • 3,384
  • 1
  • 17
  • 16
0

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.

Khaled
  • 35,688
  • 8
  • 69
  • 98