I have a social networking site with more than 2000 members, I am using dedicated server and 4.4.1 mysql. If there only 10 to 20 members online the performance of the site is fast. But if the total member online is more than 20 the site is almost useless... I ask this problem to my server why that my site is very slow when number of user online is more than 20 and they said because my database use to much resources. They ask me to optimized the db I tried the tools in phpAdmin but no effect. Any other solution to fix this problem? To lessen the to much resources being use by the mySql database.
The coding of the application will dictate that. The table structure, indexing and query. What software are you using? If it's home grown, it could take a bit of work to troubleshoot. If it's a commercial package, there should be optimization tips available.
But you still have to know what the app does to tune properly it would seem. You want an app that plays nice with everything else in a perfect world.
In your my.cnf file you can turn on "log slow queries". That might clue you into where your problems are. http://dev.mysql.com/doc/refman/4.1/en/slow-query-log.html
Try using the explain function built into MySQL which will give valuable data for how your queries are executing. As was said before try adding some timer functions which will output the execution time for each query. I'm taking a stab in the dark but am guessing it is due to inefficient queries performing entire table scans. Bobby
I agree with bobby and the rest bout application programming. Take a look at your SQL query mode. Use the visual explain to see how much CPU units your particular SQL takes. I think it's more related to the sql being used.
there are many factors that causes your site to be slow. - poor coding / poor sql statement in the script which might have many redundant database connections. - server hardware. processor speed and ram. - mysql server configuration. even if you have 8 GB RAM in the server, if you do not configure it properly for the database server to utilize the RAM, it is as if you only have 256 MB RAM or lesser. Check the following article as a start on how to configure the database variables. http://www.databasejournal.com/features/mysql/article.php/3367871
Make sure that you enable the MySQL query cache (not enabled by default). Effictiveness depends on your usage pattern, but for web access this is usually a big winner.