Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-02-2002, 01:53 PM   #1 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
All Class Files

Hey,

I have weeded throiugh all the files that we use, and these files here are all the ones that connect with the database, and do all the backend work.

Download Files as Zip

Thanks for your help...

JJ

PS: Sorry I pushed the wrong image and started a new thread instead of adding a reply to the thread I started yesterday.
These files relate to the topic "Loop in scripts causing Crashs"
mixingsoup is offline   Reply With Quote
Old 12-02-2002, 03:10 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
i havent' gone through the queries too much yet, but i am noticing you are calling on $dl->connect() in every function without ever closing your connections. i usually connect once per page by including a dbconnect script at the top. do you ever get errors like "too many connections" ?
sde is offline   Reply With Quote
Old 12-02-2002, 03:15 PM   #3 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
Yes we did, our ex-host often cut all our connections because we breached our maxaxium load. Now that you mention it, when our site overlaoded the server, we were at our peak connections, so that could have helped. I will just zip a few of the othe files together to give you an idea of howthis information is used.

Thanks.
mixingsoup is offline   Reply With Quote
Old 12-02-2002, 06:04 PM   #4 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
Here are a few of the files that those classes are used for. Thanks for taking a look at it. I looked at the logs, but they are not of much use anyway... they just show a few database calls that end when the server crashed...

Soup2.zip
mixingsoup is offline   Reply With Quote
Old 12-02-2002, 06:14 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
do you have a place you can test the scripts with this new idea in mind? i'm just about 99% positive that this is the problem if you were getting the "too many connection " errors.

i would really rather prefer not to waste too much time going through all your queries if we've possibly already found the problem. ( maybe )

if you need another host, i can recommend a good one that you will be setup very quickly at a great price.

let me know if you doubt that having too many connection calls isn't the problem and i'll look into it further.

thanks
sde is offline   Reply With Quote
Old 12-02-2002, 06:22 PM   #6 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
Hmm I can't really be sure.

I have my enterior site setup offline on my development server so I could test it their.

What I reckon it could be is the fact that we maxxed out our connections combined with the fact that the dataabse quaries are closed.

I shall look into that as well myself...

Thanks
mixingsoup is offline   Reply With Quote
Old 12-02-2002, 06:26 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
after you test that, please post the results, .. i would like to know what you come up with. if mysql doesn't hog up that cpu when using the web app, then it's probably ok to sign back up with a hosting company.

if not, lets troubleshoot it after the results of this test.
sde is offline   Reply With Quote
Old 12-02-2002, 06:28 PM   #8 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
Ok then...

Just as a side note, what whould you reccomend would be the best way to close of the database quary once it has been successfully executed?

JJ
mixingsoup is offline   Reply With Quote
Old 12-02-2002, 06:36 PM   #9 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
sometimes i am guilty of not closing my connections and it works fine, .. but then again, i usually only use 1 connection per page. once you have a successful connection, you can query as much as you want.

the proper way to close it though is
PHP Code:
<?
mysql_close
();
?>
just add that at the bottom of your script.
sde is offline   Reply With Quote
Old 12-02-2002, 06:58 PM   #10 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
sorry, don't really belong in here but i saw "class files" and thought we were talking about java ...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 12-02-2002, 07:35 PM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
=) thanks for stopping by anyway

hey minix, sorry i lost your aim when my texteditor crashed.

here is a zip file with how i think it should be. here is basically what i did.

-made the connect() function the costructor of your DB class. so now when you make a new DB class, it will connect.
-created a new DB object in your main.inc.php . make sure this is the first include in all your pages
- i took out all the other DB objects you created every one of your functions. ( like 40 of them or so =) )
- i took out all the other connect() functions ( about the same as the new objects you created)
- i took out the session_start(); in your trans.php because you are starting a new session in your main.inc.php

so basically now only 1 DB object will be created, and any function you run under that will work because you already have a connection. ( in theory )

i don't have your entire website, so it didn't make a whole lot of sense, .. but see what you can do with these.
Attached Files
File Type: zip soup2.zip (6.2 KB, 1 views)
sde is offline   Reply With Quote
Old 12-03-2002, 11:41 PM   #12 (permalink)
mixingsoup
Registered User
 
Join Date: May 2002
Location: Christchurch, New Zealand
Posts: 10
mixingsoup is on a distinguished road
Send a message via AIM to mixingsoup Send a message via Yahoo to mixingsoup
Fixed...

Well I backed up everything you did for us mmilano and started a fresh last night after you left. I seem to have fixed the problem, or at least cut down on its effects.

I went through every script and found the quaries that used the most server load (through trial and error) and either re-wrote it or removed it. I had to remove several commands but that dosen't matter in the long run. So far the site has preformed very well in all my tests, and the serverr load only spikes at certain times now (like when the usage load is high)...

Thanks for your help last night, and by reading your files I have learnt a bit as well! Your help has been duely noted on our about page.

JJ

:rock:
mixingsoup is offline   Reply With Quote
Old 12-04-2002, 06:49 AM   #13 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
Thumbs up

great! i'm happy to hear that you got it back up and running.

nice work!
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ class question saiz66 Standard C, C++ 3 06-09-2004 07:43 PM
to put data methods inside class or not? sde Java 2 05-25-2004 04:09 PM
Installing and using CMUgraphics library. Valmont Standard C, C++ 12 03-29-2003 08:39 AM


All times are GMT -8. The time now is 04:30 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting