We have a LAMP application where we have started to feel the performance pinch due to large number of concurrent users connecting to the application. I have looked at the individual parameters of Apache and MySql , where we need to configure them for better performance with large number of users and I dont think this is causing any further improvements. I would like to know if there are any other strategies we can look at for increasing the number of concurrent users who can use our web based LAMP application and without seeing a degradation in performance. Is it possible to add more apache server or more mysql servers and load balance them ?
-
Yes, it is. but what is slowing it down? Have you identified what the problem is, yet? It's hard to posit a solution before that. – BRPocock Dec 26 '11 at 01:28
-
2Please accept more of the answers to your previous questions: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Dec 26 '11 at 01:30
-
I would rather start from the other side: identify the bottlenecks that prevent your application from serving more requests. Check I/O utilization, CPU usage, network load, performance of PHP, Apache and MySQL and then begin optimization. – minaev Dec 27 '11 at 09:41
2 Answers
Probably the first biggest hit on performance for a DB-enabled application is query performance. Have you run any query analyzing on your app/DB to see where your query time is spent?
After optimizing query performance, there are other optimizing strategies for your first DB, before you consider distributing your DB to a higher performance multi-node architecture. You can look at things like: - Keys and Indexes (related to query performance, but also important for table optimization) - Database sizing & disk partitioning (including data size) - Storage engines (What version of LAMP/MySQL? MyISAM engine was default for MySQL prior to 5.5.5) - Buffer/cache tuning
You can get more information for FOSS servers, including LAMP and MySQL installations, at the FOSS Server Project, http://www.veriserver.net/a/fossmain.htm. There is a link to a tech forum at this address, which provides server administrators with FOSS assistance.
Even though people are warning against answering your questions because of your low accept rate, I'm kind of new here so not sure what that even means. Until I find out, here's some options.
First thing you need to do is find out where exactly is you app's bottleneck. Start off by going through your development copy of the app with xDebug's profiler. This will give you a very precise execution overview.
If you're unlucky and your problems show up only in production (under load), I suggest trying out Facebook's xhprof which roughly does the same thing as xDebug, but is more lightweight.
More often than not, the problem with slow apps is the database. As you're using MySQL, I suggest turning its slow query log on and letting it run for 24-48h. This will somewhat slow your app even further, but will be worth it if you figure out the problem.
After a while, you use the Percona Toolkit (ex-Maatkit)'s pk-query-digest to analyze the slow log. It might (and probably will) show you a query or two which you can fix and boost your performance.
In the end, you might end up not needing new hardware at all.

- 243
- 1
- 9