David Dreezer
Pooh-Bah
Registered: 07/21/06
Posts: 1781
so, the database returned the answer in .017 seconds, but then it took about 20 to process the answer and display it.
sounds like a machine with a ton of RAM but slow someplace else. CPU slow(ish)? drives slow(ish)?
To be honest, I've never looked at the way Rick wrote this cache stuff to see if the board needs to complete a cache creation/update operation before the page loads. If it does, and your discs are slow, that might do it.
Maybe the query that was run returned quickly, but returned a huge array of data and the CPU was too slow to operate on it faster than 20 seconds?
Either could be true. Rick would have a better idea how to look, and which to update next.
_________________________
What do you mean "You're the bomb, run away?"
Right, so if the first part is what's delaying the output, then I might be doing the wrong thing by concentrating on fine-tuning "my.cnf".
After upgrading to 2GB I just bumped the "key_buffer" to 256M (and the "table_cache" to 512). Not sure what I need exactly but I have around 700 users simultaneously at peak time and a rather large database to deal with.
Funny think is that the CPU shouldn't really be overworked as it's a Dual Xeon and in the stats it seems like it's plain sailing all the way. The drive isn't SCSI or even SATA, maybe that's the issue. But some of these delays are coming when the number of people online is about 150 and not 700. Very strange...
Rick
Registered: 06/04/06
Posts: 7883
Loc: Aberdeen, WA
As long as the 2nd number, time spent on queries, is low then your MySQL server is running and handling the queries fine. Do you have SSH access to the server? If it's a unix box then when you notice the slow times you can run 'top' on the server and get an idea of what's going on at the server level. Maybe a high load average at the time, something of that nature.
I assume you're still running 6.5? I'd keep an eye if the slow times appear on any particular pages. From the looks of the debug line it just appears that for some reason the server has a lot going on at that particular time.
Thanks guys. On a side note, if I'm having time-out issues when backing up the DB via the CP, which my.cnf setting can I alter to make sure that the backup runs smoothly?
Mors
addict
Registered: 06/26/06
Posts: 445
Loc: So. California
You also might want to look at the php.ini in the area of how many seconds are allowed to process scripts.. That's where time out errors generally come from.
max_execution_time = 240 ; Maximum execution time of each script, in seconds max_input_time = 240 ; Maximum amount of time each script may spend parsing request data memory_limit = 16M ; Maximum amount of memory a script may consume (16MB)
Also, if I decide to take a short-cut and just use the "my-huge.cnf" settings, is there anything there that I really should NOT have enabled (regardless of mem issues)?
Mors
addict
Registered: 06/26/06
Posts: 445
Loc: So. California
Don't think so .. looks good to me. for the timeout issue check the php.ini and raise the amount of time allowed for a script to run and you should be ok as far as I can tell.
Mors
addict
Registered: 06/26/06
Posts: 445
Loc: So. California
I would use the setting defaulted in my_huge.cnf. Not so sure in version 4 of MySQL but if you allowcate to much memory for paging, indexing etc.. it can have an adverse effect. we are working with standard table types here not innodb.
I have always had good luck with the defaulted settings in version 4. I run Version MySQL 5 now.
David Dreezer
Pooh-Bah
Registered: 07/21/06
Posts: 1781
Not just top, but look at some of the utilities such as iostat. If that drive is just a plain old IDE drive then you could be having your problem there. rebuilding cache, rewriting temp tables, etc. Any or all of that could be an issue. If so then dropping more memory into mysql so that it uses tmp tables less often would help to a degree, but it wouldn't be the fix-all.
_________________________
What do you mean "You're the bomb, run away?"
Many thanks guys, it's all starting to click together.
Just a quick question about backing up large tables (the posts one is over 500 megs) via the CP. If I had trouble with the process timing out, would changing the "memory_limit = 16M " variable help?
(Q2) But the total size of the dump is 483MB when checking out the file's properties using WinSCP. Is the backup truly complete?
(Q3) On a side note, am I doing the right thing by downloading the dump in binary? Or should this be done in ASCII? (I dragged the file onto my desktop using WinSCP and it started a binary transfer)
David Dreezer
Pooh-Bah
Registered: 07/21/06
Posts: 1781
Download it in ASCII.
A database dump is not going to the same size as the database.
the database is a file or files that the database creates, in it's own format, to store the data.
A data dump is most certainly not that.
open the dump and read it. the first few lines describe a table, the next lines are composed of insert statements.
the sql dump file instructs mysql on how to create the table and insert the data, it is not an actual data file that the data base can use. It is nothing more than a file that the database would use to reconstruct from, but not to operate from.
Also remember that indices take space. A dump has no indices. Another thing to think about..... when you delete something from the database the database doesn't shrink. It does not give up that space. If you delete the equivalent of 100 megs of data out of the database it still doesn't shrink. Think about it, if you delete something that's in the middle of the table why would you want mysql to rewrite everything behind it in the table in order to regain that space?
That's what optimize does. Even if you do optimize your database the sql dump will nto be the same size as the actual mysql data table. They are apples and oranges.
Can you dump a table individually? Yes, read the documentation on mysql.com for the syntax.
_________________________
What do you mean "You're the bomb, run away?"
OK, since the db/dump size is not going to be identical then I will assume that the server is giving me a complete backup.
If I dump the DB as instructed earlier in this thread (into a single file) then that's all I need to restore my database should anything bad happen, right? It'll restore all those tables from that single file?
What's the case with indeces? If the dump doesn't contain them, then what happens if I restore a DB using a dump? I get everything but the indexes? Could that pose a problem? Does the Admin CP backup copy the indeces if you do a backup that way?
Oh, and I still can't believe that what used to take 10+ hours now takes under 30 seconds. It just seems that having command line access to the server makes an incredible difference. 10 hours or 30 secs... it's just unreal.