Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Need help with mysql optimization (https://www.warriorforum.com/programming/495123-need-help-mysql-optimization.html)

ram07 29th November 2011 05:32 AM

Need help with mysql optimization
 
Hi every one,

I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

By the time the server crash gets worse. I have found few things from the error log. Here are those,

1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

Site type : Oscommerce
DB size : 127 MiB
Control panel : Plesk

Please let me know if could find any solution on this. Awaiting for your replay.

Thank you.

MariusPrice 29th November 2011 05:50 AM

Re: Need help with mysql optimization
 
Quote:

Originally Posted by ram07 (Post 5140260)
Hi every one,

I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

By the time the server crash gets worse. I have found few things from the error log. Here are those,

1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

Site type : Oscommerce
DB size : 127 MiB
Control panel : Plesk

Please let me know if could find any solution on this. Awaiting for your replay.

Thank you.

I never worked with Oscommerce but its seems that you have some writing permission problems on your server.

You had the site on this dedicated server from beginning?

Maybe i can help since i work with my own server.
Give me more details about what Linux system you running on server, do you have SSH access and whats the company from where you bought dedicated server and witch plan so i can take a look.

scriptkid 29th November 2011 06:07 AM

Re: Need help with mysql optimization
 
Quote:

1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18

Your sites traffic is too high.. may be you have to increase the no. of simultaneously sql connection limit..

ram07 29th November 2011 06:17 AM

Re: Need help with mysql optimization
 
Hi Marius,

Thanks for your quick replay. here are the details of my server.

Host : Frontline
Plan : VPS Pro Linux
Operating system : Linux 2.6.9-023stab051.3-enterprise
CPU : GenuineIntel, Intel(R) Xeon(R)CPU E5345 @ 2.33GHz
Average load : 0.12; 0.10; 0.09


Hey, I have forgot to say about the CUP usage, when we login to our admin side (2-5) members the CPU usage reaches 170%.

We have used few joint queries in orders page and listed 100 results in one page (pagination).

And also, we have used curl to get the country details and country flag using the ip address from a third party website.

These are all the information that i know about the server, SSH - i am not familiar with the server side.

Please consider these information and give you suggestion how to stop the server crash.

Thank you.

MariusPrice 29th November 2011 06:29 AM

Re: Need help with mysql optimization
 
Quote:

Originally Posted by ram07 (Post 5140425)
Hi Marius,

Thanks for your quick replay. here are the details of my server.

Host : Frontline
Plan : VPS Pro Linux
Operating system : Linux 2.6.9-023stab051.3-enterprise
CPU : GenuineIntel, Intel(R) Xeon(R)CPU E5345 @ 2.33GHz
Average load : 0.12; 0.10; 0.09


Hey, I have forgot to say about the CUP usage, when we login to our admin side (2-5) members the CPU usage reaches 170%.

We have used few joint queries in orders page and listed 100 results in one page (pagination).

And also, we have used curl to get the country details and country flag using the ip address from a third party website.

These are all the information that i know about the server, SSH - i am not familiar with the server side.

Please consider these information and give you suggestion how to stop the server crash.

Thank you.

If this is the company from where you get the server frontline .net/dedicated_linux_vsp.php then you dont seems to have Root Access.

You forget to answer to one question, this site was hosted from beginning on this Server and was working fine or you had shared hosting and then move the site on frontline ?

Also the CPU usage reaches 170% huh i never saw something like this and maybe somethings wrong there on server.

Did you tried to contact the support from frontline to see what its going on?

mojojuju 29th November 2011 11:18 AM

Re: Need help with mysql optimization
 
Well one possible problem is that you're running Plesk on a VPS plan that has 256 MB RAM. The Parallels web site says that 512 MB ram is the minimum you should have to run Plesk. And you're also trying to run Apache+MySQL on top of that.

BTW, for $45/month, you're getting screwed if they're only giving you 256 MB RAM, unless they've got a primo network or something. You'd do better if you went just about anywhere else. Hostgator, which I haven't tried but everyone here raves about, will give you 768 MB of memory for less than $45/mo.

MariusPrice 29th November 2011 02:15 PM

Re: Need help with mysql optimization
 
If you want to change your VPS there are the only two options that i use in last 4 years Managed Hosting for Smart Websites | ServInt | www.servint.net and aws.amazon.com EC2 on amazon i have a server and i pay about 14USD per month for 613 MB memory so if this is the site issue then get a better VPS

ussher 30th November 2011 12:46 AM

Re: Need help with mysql optimization
 
why are you using mysql_pconnect() ? try mysql_connect() and see if that makes a difference.

Then setup a dev server with xdebug and get some stack traces.

Run your stack traces through kcachegrind and you will see all sorts of interesting things.

Sometimes small tweaks or oversights can result in huge runtime improvements. eg, i once found i had accidentally put a query inside a loop that didnt need to be inside the loop, moving it outside the loop resulted in a massive performance gain. kcachegrind will show you this kind of stuff.

MariusPrice 1st December 2011 04:53 PM

Re: Need help with mysql optimization
 
Quote:

Originally Posted by ram07 (Post 5140260)
Hi every one,

I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

By the time the server crash gets worse. I have found few things from the error log. Here are those,

1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

Site type : Oscommerce
DB size : 127 MiB
Control panel : Plesk

Please let me know if could find any solution on this. Awaiting for your replay.

Thank you.

I will try to help you, sent me a pm how i can be in touch with you, give me your skype if you have or Gtalk


All times are GMT -6. The time now is 08:02 AM.