Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Maxing out the CPU...


bobsi18

Recommended Posts

Posted

Hi there... after some expert advice :)

 

My website went down today, and about 5 minutes after going down, I got a call from my host. My host informed me that my website was exceeding CPU usage.

 

My site is an online store running oscommerce. No core files have been changed recently, the database has had only minor modifications (adding new products, orders, etc). The site has been running without problems for quite some time (months, maybe even a year?). We did have more traffic than usual today, as we have a large online promotion happening, but not huge numbers.

 

I have currently taken the website offline, as the host has said that it is causing problems for other users. However, I (and my host) have no idea what is going on, and how to fix it. It's really important that I get it going ASAP, due to the promotion we are attempting to run.

 

If any other details are needed, please let me know. Any ideas are welcomed!

 

~bobsi18~

Posted

I dont think it is a good host to just take a site down without any prior warning, so perhaps it is time to consider switching host. and I dont think there would be a quick fix that you could do in half hour or so to please your host.

For the future, there's a topic started by Chemo in the Tricks & Tips called something like An osC Optimization in Progress, which you might want to read.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted
I dont think it is a good host to just take a site down without any prior warning, so perhaps it is time to consider switching host. and I dont think there would be a quick fix that you could do in half hour or so to please your host.

For the future, there's a topic started by Chemo in the Tricks & Tips called something like An osC Optimization in Progress, which you might want to read.

 

Ken

 

Hi Ken,

Thanks for the reply. However, it was me that took down the site (albeit after them threadtening to suspend the account, I'd rather have a little control over the problem)...

 

The strange thing is that this has (as far as I can tell) just started happening - it was running fine yesterday. I've actually read chemo's thread and have a number of his tips and contributions running on the site - normally it's fine, but recently something has happened to make it not fine, and i have no idea what it is...

Posted

Is there any statistic to support your host claim? what is the upper limits? Are these defined in the ts&cs? or they just want you upgade your account and pay more? Watever, it is no good to have the site down at this very moment, I suppose?

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted

Nope, no stats to speak of, but I watched the CPU through cpanel when I reactivated the store temporarily, and it went off the wall - from 0.55 to 6.86.

 

Yep, at the moment, just trying to get the site operational - our major promotion started just this morning, need people to be able to access our site

Posted

I know you are in rather a hurry to get things moving again, but if you haven't just changed anything could it simply be hundreds of users? What did the who's on-line say?

 

Do you have the contribution 'Down for Maintenance' installed so you can test things on your site without any real customers logging in? Or have you tried running it locally on your PC using xampp?

 

It doesn't seem as if your host is bad as they did call you!

 

All the best

David

Posted

i agree - i am happy with the host, they talked to me over the phone 2ce today.

 

It's definetly my site, I've confirmed that myself - I have the down for maintennance contrib and am using it. I took it off, and watched the CPU - it went up really fast, so it's back on again. I'm testing things, but really not sure what's going on. The host says theres a crazy query and each time it runs, it's consuming 100% CPU usage. If it's running 4 times, it goes to 300-400% CPU.

Posted

First you need to locate what query (if it's a query does that) Try to eliminate the common store's sections first. Footer, Header, Left/Right columns check the code and comment out the sql queries. It may cause some side effects but the store should still be functional and you can check the cpu usage. It can still be one of the common files like application_top.php for example or one of the class files so these come next for checking.

Posted
First you need to locate what query (if it's a query does that) Try to eliminate the common store's sections first. Footer, Header, Left/Right columns check the code and comment out the sql queries. It may cause some side effects but the store should still be functional and you can check the cpu usage. It can still be one of the common files like application_top.php for example or one of the class files so these come next for checking.

 

This is very good troubling shooting. If the trouble starts as soon as you call up the main page.

 

Your host or yourself if you have access should be able to view the mysql log and the php error logs. This may give you a clue as to where the issue is originating. I solve many issues rather quickly by going to the error logs. Unless you know for certain itis a query it may be a loop and not a query causing the problem.

 

I really hate that phantom coder. He comes in when no one is around and just randomly rewrites your code. Someone should fire that guy.

 

Good Luck

How do you know when you know what you want to do for the rest of your life?

Posted

If you don't have access to the logs you can install the contribution of Chemo's that allows you to see the execution time of your queries (and remove it before setting your store live again).

Posted

I run servers myself and the only time i have ever seen large loads on them is when a spammer gets on the server ( thankfully I haven't had one in a nearly two years) but when i have had in the past the quickest and easiest way to deal with the problem was to see what domain they where going through and suspend it

 

The host should be able to tell you what process is taking up the resources and if its not something thats required for OSC then ask them to remove it

 

if it comes back then their is a security issue somewhere he will try and tell you its you but i would say that chances is its something to do with the server not being secured properly since its very easy to hire a server and sell hosting its not so easy to keep it secure

 

If they cant tell you what process is taking up the resources then their not a very good host and i would look else where although that doest resolve the problem of here and now it will stop it happening in the future

Posted

Well this might happen in a case as stated below:

1)Some one tries to hack your site by continuosly posting to some of Your pages.Generally done to send spam emails.

This will result in a page being executed 100 times plus ina minute.With categories.php consuming lot of data base resources.

So first check Your log to make out that this is not the case.If this is the case block the hacker IP(three four IPs they do have) using htaccess.

Also place some code in application_top to check IP and maintain some counter so that if an IP keeps hitting for too many times in a minute then it should be placed in the banned IP llist.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

Thanks for all the suggestions, I really appreciate it:

 

- I am 99.99% sure it isn't a hacker - my host was able to identify the I.P. address when it happened at one stage yesterday - it was a known customer. Since then we've had it happen over and over again with different people.

 

- The host has said that it isn't a loop (not sure how they know?)

 

- The error logs are meaningless - they seem to be cleared everytime the cpu starts getting out of control, so i can't read anything off them :(

 

- I haven't been able to narrow it down to anything in particular - the server must be hosting quite a few sites - the CPU ranges between 0.3 to 1.12 regularily. To test it's my site, I've been turning the site back on, and, as more people come onto the site (we're only talking 10-20 customers + bots) it climbs, till it hits about 4, and I pull the site again. I really can't see a pattern. For example, the site is back on again now, and I have one customer browsing and adding items to their cart. This doesn't appear to be changing the CPU.

 

-mysql records - how do i access these? (i am using cpanel and myphpadmin)

 

thanks again all

Posted

sometimes sitting back helps - my host was able to give me the beginning of the dodgy query, and this is what I have decided the problem is:

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, pd.products_url, p.products_price, p.products_weight, p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8, p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty, p.products_qty_blocks, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd,	  products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id,	  products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1'   and p.products_id = '990'   and pd.products_id = '990'   and pd.language_id = '1'

 

now i'm just trying to find where it is... this was found on one of my product pages that has a special on, so i'm working through it...

Posted
sometimes sitting back helps - my host was able to give me the beginning of the dodgy query, and this is what I have decided the problem is:

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, pd.products_url, p.products_price, p.products_weight, p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8, p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty, p.products_qty_blocks, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd,	  products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id,	  products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1'   and p.products_id = '990'   and pd.products_id = '990'   and pd.language_id = '1'

 

now i'm just trying to find where it is... this was found on one of my product pages that has a special on, so i'm working through it...

 

FOUND IT!!! It was in PriceFormatter.php, has been there since day one, got some updated code and all is good again. Thanks for your help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...