Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

Reply
 
Thread Tools Display Modes
Old 05-03-2007, 23:45   #11
Garp
Preparing more tumbleweed
 
Garp's Avatar
 
Join Date: Jun 2006
Location: Hawaii
Posts: 6,038
Default

Quote:
Originally Posted by petemc View Post
Right. I've looked into this a lot more now. Here's the deal. Wordpress doesn't forceably close MySQL connections because non-persistant connections are automatically closed at the end of a scripts execution.
In other words, lazy programming. All it takes is a single command to close the connection, and they could have used it.
__________________
Mal: Define "interesting"?
Wash: "Oh, God, oh, God, we're all gonna die"?
Garp is offline   Reply With Quote
Old 06-03-2007, 01:05   #12
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

Aye. It's one thing I always do. In fact, I have code that detects connections left open, and will complain (and close them).
Mark is offline   Reply With Quote
Old 06-03-2007, 12:01   #13
petemc
Moonshine
 
Join Date: Jul 2006
Location: Nr Liverpewl
Posts: 4,371
Default

Quote:
Originally Posted by Garp View Post
In other words, lazy programming. All it takes is a single command to close the connection, and they could have used it.
Maybe, but the documentation does say;

Quote:
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources.
The comments on the page also say;

Quote:
RonS is mostly incorrect about mysql_close. It's not necessarily good programming practice to always explicitly close your database connect as it might be in other languages. Your connection will be closed as soon as your script is finished, so there is almost never a need to call mysql_close at the end of a script.
Not defending them, just trying to get a better understanding
petemc is offline   Reply With Quote
Old 06-03-2007, 12:06   #14
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

While the diagnosis seems possible, I would suggest not putting the blame on bad coding before determining whether or not there is some other cause. Only the logs will tell you that.
Mark is offline   Reply With Quote
Old 06-03-2007, 13:17   #15
petemc
Moonshine
 
Join Date: Jul 2006
Location: Nr Liverpewl
Posts: 4,371
Default

Annoyingly I only have access to the raw access logs which only show http connections. My host said they don't have MySQL logs or anything. I'm trying to setup a local copy so I can do some stress testing.
petemc is offline   Reply With Quote
Old 06-03-2007, 13:23   #16
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

It's HTTP you need. MySQL doesn't keep human-readable logs anyway.
Mark is offline   Reply With Quote
Old 06-03-2007, 14:36   #17
petemc
Moonshine
 
Join Date: Jul 2006
Location: Nr Liverpewl
Posts: 4,371
Default

Oh right. It just looks normal, afaik. Its a 287mb file for access since the 28th Feb. I know I had trouble on the 2nd March in the evening but I'm guessing all I'd find would be connections to my HDR guide and perhaps the Wordpress error page being returned (if it shows that much). The error page basically says it can't connect to the db.
petemc is offline   Reply With Quote
Old 07-03-2007, 03:06   #18
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

That's quite a lot of traffic for 7 days. I don't know the percentage of wordpress vs HDR, but it's possible you've outgrown your service and not realised it.

If you know when the error happened, you can see how many connections were attempted in the few minutes before the error. There are some useful tools for trawling through logs, but most of them live on *nix.
Mark is offline   Reply With Quote
Old 07-03-2007, 12:18   #19
petemc
Moonshine
 
Join Date: Jul 2006
Location: Nr Liverpewl
Posts: 4,371
Default

I'm pretty sure I've outgrown them. The package I'm on was 20gb/month and 1.5gb space. Now don't tell them but in Feb I did 49.9gb and so far this month I've done 37gb *ahem*. If it wasn't for the way that there are sleeping connections left lying around for 10 minutes I'd just accept that my site is getting too much traffic for 10 connections to the server. I've installed a caching script that seems to have helped. But yeah, I do think its new host time.
petemc is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:31.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.