Results 11 to 20 of 37
-
29th Jul 2012, 04:01 AM #11Member
You are lucky. my vps got suspended due to +10% CPU load. but they returned me again with last warning.
buy a vps with 1gb-2gb ram and 4+ cores
-
29th Jul 2012, 09:10 AM #12OPMember
Okay the site is a index site, indexing mirrors for files. It's nothing with torrents, just files. For example the home page grabs 50 of the files in the db and lists them, then when the user clicks one of them, the scripts grabs all the mirrors that are related to that file (normally around 3).
Before it got shutdown the mirror table had around 20k mirrors, and the files table around 4k entries.
It's just basic queries as INSERT, SELECT and maybe one or two UPDATE when I add new mirrors (only I could do it).
EDIT: I could provide you with some snippets that are used the most, wait a sec and I'll paste them somewhere.
---------- Post added at 11:10 AM ---------- Previous post was at 10:49 AM ----------
Before I start, the file "dblogin.php" just opens the MySQL connection and selects the correct DB.
Here is the code for retrieving addons (as you can see it outputs in JSON), this page is fetched with jQuery and parsed and shown to the user:
http://pastebin.com/Gb1ZVicb
This function is called a lot by the API, every time a user loads a kind of page, a greasemonkey script calls this function to see what to do:
http://pastebin.com/qLMfy3uR
I hope this can help you a little. I am really glad you guys a trying to help me
EDIT: this was the pic the host sent me: http://slickimg.com/images/2012/07/26/Z8rNc.png
-
29th Jul 2012, 12:11 PM #13Banned
Basically its grabbing the mirrors and updating your database. If thats a bit frequent, then mysql seems to be the issue here.
I feel mysql is not properly optimized which is also leading to the high resource usage.
-
29th Jul 2012, 12:21 PM #14Member
Find a Xen PV or a XenHVM VPS provider and you will not be banned due to this reason.
I installed Gentoo Linux & FreeBSD on those VPS and compile the kernel, world, and all packages (which means use 100% CPU resources more than 48 hours) without any issues.
However, these VPS have some I/O issues due to its virtualization technology.
-
29th Jul 2012, 12:40 PM #15Member
Why are you using SELECT * if you're not using all of the columns? Seems like your queries are the culprit.
-
29th Jul 2012, 01:01 PM #16Too busy :|Website's:
L337Fx.com BeastieBay.netJust get a better server and optimize it.
-
29th Jul 2012, 02:26 PM #17Member
Looks about right, select * usage could be tweaked. But then again the first part may be important to return the result with all columns.
PHP Code:else
{
//Has no mirrors, though it still may exist
$result = mysql_query("SELECT * FROM addons WHERE id = $addonID");
if (mysql_num_rows($result))
{
//It has been requested
return -1;
}
else
{
//It hasn't been requested
return 0;
}
PHP Code:SELECT count(*) FROM addon_mirrors/addons WHERE id = "$addonID"
QFT, it sounds like he may have just transferred to PAID shared hosting.
A suggestion if this getting mirror count is an issue. You could just create another small table with id and # of mirrors. You update the table whenever you add a new mirror. Can't really suggest anything else without looking at your whole site.
-
29th Jul 2012, 03:26 PM #18OPMember
Well the reason for me not using a Google like cluster to drive my website is the same as for probably the most of you: I don't have the money.
If I had 20$ each month that in the end just would end up in a drawer, I would have a VPS. But I don't. I recently upgraded to paid, shared hosting. If it is impossible to host my site without a VPS, I will have to shut it down permanently.
Anyway, I really appreciate all the tips you guys have been giving me!
Unfortunately, I'm going on vacation tomorrow, so I can't really test anything yet. (I still have no host to test it at atm). But my new hosts "PHP & MySQL specialist" is looking into my scripts, I'll leave it to him and I'll hope he will fix it and get my website up before I come back!
Still, it feels like "just" optimizing my mysql won't take the load down to 5% or something like that :/ I'm hoping I'm wrong...
-
29th Jul 2012, 04:01 PM #19Member
remove all that taks too much ram and you will be fine
VOTE FOR FREEDOM, VOTE FOR GARY JOHNSON 2012!!
-
1st Aug 2012, 10:13 PM #20MemberWebsite's:
Xentos.nl
I Do agree, People suggest to optimize and tweak the server is not everything, as far i've read you have low visitor count. So the problem is with your PHP Code. For example what futureawesome has posted, I do not know if it's a orginal used script. But 'limit' is important in most query's
for example:
PHP Code:$result = mysql_query("SELECT * FROM addons WHERE id = $addonID");
if (mysql_num_rows($result))
if (mysql_num_rows($result)) // Can only receive boolean's True | False | 0 | 1
There is no need to receive for example 3222 on num_rows since we only need 0 = none or 1 = Yes
$result = mysql_query("SELECT * FROM addons WHERE id = $addonID LIMIT 1");
Also Please do not forget about security.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Website Load/Capacity Testing
By jamilv in forum Webmaster DiscussionReplies: 0Last Post: 22nd Aug 2012, 08:40 PM -
Want to know your website load speed?
By DoggY DuKe in forum Useful SitesReplies: 4Last Post: 14th Dec 2011, 12:50 AM -
Check Website Load Time & Provides Optimizations
By viruz99 in forum General DiscussionReplies: 2Last Post: 7th Oct 2011, 08:08 PM -
Fajax - How to make your Website/Forum "load" faster
By Smith in forum Webmaster ResourcesReplies: 5Last Post: 30th Oct 2010, 05:22 AM -
Website does not load in browser but does in proxy
By StarTech in forum Technical Help Desk SupportReplies: 2Last Post: 31st Mar 2010, 07:36 AM
themaPoster - post to forums and...
Version 5.18 released. Open older version (or...