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 ?
migrated from stackoverflow.com Dec 26 '11 at 10:03
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.